No problem for the Control, but for the shift shortcuts it gets more complicated, I have 7 of them on my rogue, which is no such a problem because I know them al, the problem is when I go on rerolls
So if someone knows an add-on, or know how to create shortcuts to replace
Look at UIParent.lua, in the function GetBindingText():
local modKeys = '';
if ( not dashIndex ) then
dashIndex = 0;
else
modKeys = strsub(name, 1, dashIndex);
if ( tempName == "CAPSLOCK" ) then
gsub(tempName, "CAPSLOCK", "Caps");
end
-- replace for all languages
-- for the "push-to-talk" binding
modKeys = gsub(modKeys, "LSHIFT", LSHIFT_KEY_TEXT);
modKeys = gsub(modKeys, "RSHIFT", RSHIFT_KEY_TEXT);
modKeys = gsub(modKeys, "LCTRL", LCTRL_KEY_TEXT);
modKeys = gsub(modKeys, "RCTRL", RCTRL_KEY_TEXT);
modKeys = gsub(modKeys, "LALT", LALT_KEY_TEXT);
modKeys = gsub(modKeys, "RALT", RALT_KEY_TEXT);
-- use the SHIFT code if they decide to localize the CTRL further. The token is CTRL_KEY_TEXT
if ( GetLocale() == "deDE") then
modKeys = gsub(modKeys, "CTRL", "STRG");
end
-- Only doing French for now since all the other languages use SHIFT, remove the "if" if other languages localize it
if ( GetLocale() == "frFR" ) then
modKeys = gsub(modKeys, "SHIFT", SHIFT_KEY_TEXT);
end
end
if ( returnAbbr ) then
if ( count > 1 ) then
return "·";
else
modKeys = gsub(modKeys, "CTRL", "c");
modKeys = gsub(modKeys, "SHIFT", "s");
modKeys = gsub(modKeys, "ALT", "a");
modKeys = gsub(modKeys, "STRG", "st");
end
end
As you can see, for frFR, "SHIFT" is replaced with "MAJ" (SHIFT_KEY_TEXT). Later, if Abbreviations are requested (returnAbbr evaluates to true) the "SHIFT" is replaced with a "s". Obviously, in frFR, there's no "SHIFT" to replace.
Modifying GetBindingText() yourself is a bad idea. Expect tainting of the action bars if you do so.
One solution would be to securely Hook "ActionButton_UpdateHotkeys", which is the function used by Blizzard to update the HotKey text in ActionButtons and that calls GetBindingText. Something like this might be enough:
hooksecurefunc(ActionButton_UpdateHotkeys, function (self)
local hotkey = _G[self:GetName().."HotKey"]
hotkey:SetText(hotkey:GetText():replace("MAJ", "m"))
end)
It must be executed once per session. You can make a simple addon, by creating a new Subdirectory in your wow/Interface/AddOns directory, named FixFrenchMaj, for instance.
In this directory, create a file "FixFrenchMaj.TOC" with the following content:
# Interface: 30000
fix.lua
Also create a "fix.lua" file with the following content:
hooksecurefunc(ActionButton_UpdateHotkeys, function (self)
local hotkey = _G[self:GetName().."HotKey"]
hotkey:SetText(hotkey:GetText():replace("MAJ", "m"))
end)
Date: 2011-06-29 18:06:09
ID: 2
Error occured in: Global
Count: 810
Message: ..\AddOns\FixFrenchMaj\fix.lua line 3:
attempt to call method 'replace' (a nil value)
Debug:
[C]: replace()
FixFrenchMaj\fix.lua:3:
FixFrenchMaj\fix.lua:1
[C]: ActionButton_UpdateHotkeys()
..\FrameXML\ActionButton.lua:468: ActionButton_OnEvent()
[string "*:OnEvent"]:1:
[string "*:OnEvent"]:1
My addon :
hooksecurefunc("ActionButton_UpdateHotkeys", function (self)
local hotkey = _G[self:GetName().."HotKey"]
hotkey:SetText(hotkey:GetText():replace("MAJ", "m"))
end)
In Perl, we can use \Q and \E to "quote" a string in a pattern so that any special characters are automatically escape. Using "\Q[[test]]+\E" would be the same as "\[\[test\[\]\+". Is there something similar in Lua pattern matching?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Ill try to be as clear as possible, here is my problem :
When I put shortcuts in my actionbar like :
R, X, C, etc: its all ok
2-buttons shortcuts like
ctrl+R shift+E displays like this:
c-R, Shi
SCREENSHOT : http://img136.imageshack.us/img136/8195/wowscrnshot030209092920.jpg
No problem for the Control, but for the shift shortcuts it gets more complicated, I have 7 of them on my rogue, which is no such a problem because I know them al, the problem is when I go on rerolls
So if someone knows an add-on, or know how to create shortcuts to replace
Shi by S-E
Thank you
PS : MAJ = SHIFT
SHIFT = 5 Carac
CTRL = 4 Carac
the client cut 4 carac + :(
Look at UIParent.lua, in the function GetBindingText():
As you can see, for frFR, "SHIFT" is replaced with "MAJ" (SHIFT_KEY_TEXT). Later, if Abbreviations are requested (returnAbbr evaluates to true) the "SHIFT" is replaced with a "s". Obviously, in frFR, there's no "SHIFT" to replace.
Modifying GetBindingText() yourself is a bad idea. Expect tainting of the action bars if you do so.
One solution would be to securely Hook "ActionButton_UpdateHotkeys", which is the function used by Blizzard to update the HotKey text in ActionButtons and that calls GetBindingText. Something like this might be enough:
In this directory, create a file "FixFrenchMaj.TOC" with the following content:
Also create a "fix.lua" file with the following content:
Date: 2009-03-06 23:47:07
ID: 1
Error occured in: Global
Count: 1
Message: ..\AddOns\FixFrenchMaj\fix.lua line 1:
Usage: hooksecurefunc([table,] "function", hookfunc)
Debug:
[C]: ?
[C]: hooksecurefunc()
FixFrenchMaj\fix.lua:1: in main chunk
[FONT=monospace]
Thanks You very very veryyyyyy much :)
:D
This is my "addon" :
http://wow.curseforge.com/addons/fixfrenchmaj/
but i have this error :
My addon :
How can i fix ?
Thanks you :)
What's gsub ? :/
afaik it's similar to strreplace, but that it also supports "Lua patterns"