I updated LibResComm-1.0 and SmartRes2 earlier today, because of changes to Ace3, and I wanted to get the latest translations for LRC. Unfortunately, this had to be dry coded because of my sabbatical from WoW.
Since all I did in the lib was put in translations, I followed the previous format, but something is not correct, and I can't load it in game myself.
So I am asking for a bit of help, please. Here is the error, and here is the paste of the lib.
What would be grand would be just use keyword substitution, but that looked like a mixed bag, probably because I am not 100% certain how to do that. Once I had an alpha committed, it looked like
You notice the missing [" and "] around Reincarnate? That was after using
@localization(locale="deDE", format="lua_table")@
Anyway, I would still prefer keywords. Do I have to comment that line before I SVN commit, or leave it exactly like printed? Is there anything I need to do in Tortoise, or will the packager handle it?
if LOCALE == "deDE" then
@localization(locale="deDE", format="lua_table")@
elseif LOCALE == "esES" or LOCALE == "esMX" then
@localization(locale="esES", format="lua_table")@
end
Or is it commented like so
if LOCALE == "deDE" then
--@localization(locale="deDE", format="lua_table")@
elseif LOCALE == "esES" or LOCALE == "esMX" then
--@localization(locale="esES", format="lua_table")@
end
You notice the missing [" and "] around Reincarnate?
it should be valid lua, you dont have to have string keys in quotes if there are no spaces or lua bits in the key name. its just visually more obvious whats going on if you use the square brackets and quotes.
also, the localisation just inserts a table, you dont appear to be assigning it to anything though? i presume you mean something like L = @localisation@
I wonder why it wasn't throwing errors before? Been fine for months and months. Lucky me. It is correct to comment the line? The KB article suggests yes, but I want to make sure. :p
if LOCALE == "deDE" then
L = {
--@localization(locale="deDE", format="lua_table")@
}
elseif LOCALE == "esES" or LOCALE == "esMX" then
L = {
--@localization(locale="esES", format="lua_table")@
}
end
I wonder why it wasn't throwing errors before? Been fine for months and months. Lucky me. It is correct to comment the line? The KB article suggests yes, but I want to make sure. :p
if LOCALE == "deDE" then
L = {
--@localization(locale="deDE", format="lua_table")@
}
elseif LOCALE == "esES" or LOCALE == "esMX" then
L = {
--@localization(locale="esES", format="lua_table")@
}
end
don't know.
may be:
if LOCALE == "deDE" then
L =
@localization(locale="deDE", format="lua_table")@
elseif LOCALE == "esES" or LOCALE == "esMX" then
L =
@localization(locale="esES", format="lua_table")@
end
is correct. without --, { and }, because the loca tool generates '{key=value, key=value, ...}' out of '@localization...@'.
BUT: I don't know exactly.
If anyone is like me, and learning the keyword localization, this worked:
local L = {
-- use global string for locale independence
CORPSE_OF = "^" .. CORPSE_TOOLTIP:replace("%s", "(.+)"),
-- needs to match return values from HasSoulstone()
["Use Soulstone"] = "Use Soulstone",
["Reincarnate"] = "Reincarnate",
["Twisting Nether"] = "Twisting Nether",
-- sensible text to show
["Soulstone"] = "Soulstone",
}
local LOCALE = GetLocale()
if LOCALE == "deDE" then
L = --@localization(locale="deDE", format="lua_table")@
elseif LOCALE == "esES" or LOCALE == "esMX" then
L = --@localization(locale="esES", format="lua_table")@
elseif LOCALE == "frFR" then
L = --@localization(locale="frFR", format="lua_table")@
elseif LOCALE == "ruRU" then
L = --@localization(locale="ruRU", format="lua_table")@
elseif LOCALE == "koKR" then
L = --@localization(locale="koKR", format="lua_table")@
elseif LOCALE == "zhCN" then
L = --@localization(locale="zhCN", format="lua_table")@
elseif LOCALE == "zhTW" then
L = --@localization(locale="zhTW", format="lua_table")@
end
If anyone is like me, and learning the keyword localization, this worked:
local L = {
-- use global string for locale independence
CORPSE_OF = "^" .. CORPSE_TOOLTIP:replace("%s", "(.+)"),
-- needs to match return values from HasSoulstone()
["Use Soulstone"] = "Use Soulstone",
["Reincarnate"] = "Reincarnate",
["Twisting Nether"] = "Twisting Nether",
-- sensible text to show
["Soulstone"] = "Soulstone",
}
local LOCALE = GetLocale()
if LOCALE == "deDE" then
L = --@localization(locale="deDE", format="lua_table")@
elseif LOCALE == "esES" or LOCALE == "esMX" then
L = --@localization(locale="esES", format="lua_table")@
elseif LOCALE == "frFR" then
L = --@localization(locale="frFR", format="lua_table")@
elseif LOCALE == "ruRU" then
L = --@localization(locale="ruRU", format="lua_table")@
elseif LOCALE == "koKR" then
L = --@localization(locale="koKR", format="lua_table")@
elseif LOCALE == "zhCN" then
L = --@localization(locale="zhCN", format="lua_table")@
elseif LOCALE == "zhTW" then
L = --@localization(locale="zhTW", format="lua_table")@
end
If you're doing it that way, for all locales other than English you're creating an extra table and then garbage collecting it for absolutely no reason. Does the localization app not do "additive" tables? eg:
base_table = {
["key1"] = "value1",
}
if condition then
base_table["key1"] = "value2"
end
It does do additive, but in my ignorance, I thought that was for AceLocale only. Since I cannot get into game, and if what I have done does not work, I welcome anyone to fix it. At this point, I just wanted my guild off my back because it was raid night tonight and they wanted it working; there is time now to play with the code and improve it.
Since all I did in the lib was put in translations, I followed the previous format, but something is not correct, and I can't load it in game myself.
So I am asking for a bit of help, please. Here is the error, and here is the paste of the lib.
What would be grand would be just use keyword substitution, but that looked like a mixed bag, probably because I am not 100% certain how to do that. Once I had an alpha committed, it looked like
You notice the missing [" and "] around Reincarnate? That was after using
Anyway, I would still prefer keywords. Do I have to comment that line before I SVN commit, or leave it exactly like printed? Is there anything I need to do in Tortoise, or will the packager handle it?
As for the second error, that's because of the syntax error in the Lib's code.
Or is it commented like so
it should be valid lua, you dont have to have string keys in quotes if there are no spaces or lua bits in the key name. its just visually more obvious whats going on if you use the square brackets and quotes.
also, the localisation just inserts a table, you dont appear to be assigning it to anything though? i presume you mean something like L = @localisation@
could be wrong as i dont use curse localisations.
yep, Arkayenro. the 'L =' before { is missing in all locales.
don't know.
may be:
is correct. without --, { and }, because the loca tool generates '{key=value, key=value, ...}' out of '@localization...@'.
BUT: I don't know exactly.
where you were mentioning TortoiseSVN ..
If you're doing it that way, for all locales other than English you're creating an extra table and then garbage collecting it for absolutely no reason. Does the localization app not do "additive" tables? eg:
?