Module:I18n: Difference between revisions
From Elwiki
m (Fix non-existent translations) |
(Add i18n.getTranslatedTitle) |
||
Line 56: | Line 56: | ||
return translations | return translations | ||
end | end | ||
function i18n.getTranslatedTitle(title, lang) | |||
title = title or '' | |||
lang = lang or '' | |||
local title_full = title .. lang | |||
local display_title | |||
if title_full then | |||
local tp = mw.title.makeTitle('', title_full) | |||
if tp.exists then | |||
display_title = string.match(tp:getContent(), "%{%{DISPLAYTITLE:([^}]-)%}%}") | |||
end | |||
end | |||
return display_title | |||
end | |||
function i18n.translate(translations, key) | function i18n.translate(translations, key) |