Module:Luacard: Difference between revisions

From Archon Arcana - The KeyForge Wiki
Just trying to remove the translation.
No edit summary
(Just trying to remove the translation.)
Tag: Reverted
Line 44: Line 44:
local templates = require('Module:LuacardTemplates')
local templates = require('Module:LuacardTemplates')
local cardstyle = require('Module:LuacardStyle')
local cardstyle = require('Module:LuacardStyle')
local translations = require("Module:LocaleTable") -- double quotes to not stage
--local translations = require("Module:LocaleTable") -- double quotes to not stage
local luastache = require("Module:luastache")  -- double quotes to not stage
local luastache = require("Module:luastache")  -- double quotes to not stage


local translate_table = {}
--local translate_table = {}


local translate = function(word)
--local translate = function(word)
if(translate_table[word]~=nil) then
-- if(translate_table[word]~=nil) then
return translate_table[word]
-- return translate_table[word]
else
-- else
return word
-- return word
end
-- end
end
--end


function insert_translated(tab)
--function insert_translated(tab)
local trans_tab = {}
-- local trans_tab = {}
for k,v in pairs(tab) do
-- for k,v in pairs(tab) do
trans_tab[k..'_t'] = translate(v)
-- trans_tab[k..'_t'] = translate(v)
end
-- end
combine(tab, trans_tab)
-- combine(tab, trans_tab)
end
--end


function stachify(table)
function stachify(table)
Line 96: Line 96:
function stache(s, tab)
function stache(s, tab)
stachify(tab)
stachify(tab)
insert_translated(tab)
-- insert_translated(tab)
s = '{{=${ }=}}'..s
s = '{{=${ }=}}'..s
return luastache:render(s, tab)
return luastache:render(s, tab)
Line 116: Line 116:
end
end


local translate_trait = function(frame, type, word)
--local translate_trait = function(frame, type, word)
if(frame.args.locale) then
-- if(frame.args.locale) then
if(not translations[type][frame.args.locale]) then
-- if(not translations[type][frame.args.locale]) then
return word
-- return word
end
-- end
if(not translations[type][frame.args.locale][mw.ustring.lower(word)]) then
-- if(not translations[type][frame.args.locale][mw.ustring.lower(word)]) then
return word
-- return word
end
-- end
return mw.ustring.upper(translations[type][frame.args.locale][mw.ustring.lower(word)])
-- return mw.ustring.upper(translations[type][frame.args.locale][mw.ustring.lower(word)])
else
-- else
return word
-- return word
end
-- end
end
--end


local load_translation_table = function(locale)
--local load_translation_table = function(locale)
local translate_table_results = cargo_results(
-- local translate_table_results = cargo_results(
'TranslationTable',
-- 'TranslationTable',
'EnglishText,Type,TranslatedText',
-- 'EnglishText,Type,TranslatedText',
{
-- {
where='Locale="'..locale..'"'
-- where='Locale="'..locale..'"'
})
-- })
for r=1, #translate_table_results do
-- for r=1, #translate_table_results do
local result = translate_table_results[r]
-- local result = translate_table_results[r]
translate_table[result.EnglishText] = result.TranslatedText
-- translate_table[result.EnglishText] = result.TranslatedText
end
-- end
end
--end


local apply_altart = function(frame, vars)
local apply_altart = function(frame, vars)
Line 219: Line 219:
local split = mw.text.split(vars.cardtraits, ' • ')
local split = mw.text.split(vars.cardtraits, ' • ')
vars.cardtraits = {}
vars.cardtraits = {}
vars.translate_trait = function(self)
-- vars.translate_trait = function(self)
return translate_trait(frame, 'traits', self.trait)
-- return translate_trait(frame, 'traits', self.trait)
end
-- end
for i = 1, #split do
for i = 1, #split do
append(vars.categories, split[i])
append(vars.categories, split[i])