Module:Utilities
From Pathfinder Wiki
Revision as of 19:53, 16 July 2021 by DesignerThan (talk | contribs) (Created page with "local p = {} function p.localize( frame, strToTrans, langSuffix, page ) if ( page == nil or page == '' ) then page = 'All' end -- check if input is a number if ( tonu...")
Documentation for this module may be created at Module:Utilities/doc
local p = {}
function p.localize( frame, strToTrans, langSuffix, page )
if ( page == nil or page == '' ) then
page = 'All'
end
-- check if input is a number
if ( tonumber(strToTrans) == nil ) then
return strToTrans
end
local strFromTrans = frame:callParserFunction( '#lst', { 'Localization:'..page..langSuffix, strToTrans})
-- did translation work?
if ( strFromTrans ~= '') then
return strFromTrans
else
-- add to error category
-- [[Category:Missing Localization/{{{2|All}}}/{{{1|unsupplied}}}{{GetLangSuffix}}]]
local newErrorCategory = '[[Category:Missing Localization/'..page..'/'..strToTrans..langSuffix
local errorCategories = frame:callParserFunction( '#var', 'localizationErrorCategories' )
frame:callParserFunction( '#vardefine', { 'localizationErrorCategories', errorCategories..newErrorCategory } )
return nil
end
end
return p