Difference between revisions 2344 and 2345 on wawikisource--[[ __ __ _ _ _ _ _ _ _ | \/ | ___ __| |_ _| | ___ _ / \ _ _| |_ ___ | |_ _ __ __ _ _ __ ___| | __ _| |_ ___ | |\/| |/ _ \ / _` | | | | |/ _ (_) / _ \| | | | __/ _ \| __| '__/ _` | '_ \/ __| |/ _` | __/ _ \ | | | | (_) | (_| | |_| | | __/_ / ___ \ |_| | || (_) | |_| | | (_| | | | \__ \ | (_| | || __/ |_| |_|\___/ \__,_|\__,_|_|\___(_)_/ \_\__,_|\__\___/ \__|_| \__,_|_| |_|___/_|\__,_|\__\___| (contracted; show full) -- get language fallback list if not args.lang or not mw.language.isSupportedLanguage(args.lang) then args.lang = frame:callParserFunction( "int", "lang" ) -- get user's chosen language end local langList = mw.language.getFallbacksFor(args.lang) table.insert(langList,1,args.lang) table.insert(langList,math.max(#langList,2),'default')⏎ -- find base page local base = args.base args.base = nil assert(base and #base>0, 'Base page not provided for autotranslate' ) if not mw.ustring.find(base,':') then -- if base page does not indicate namespace base = 'Template:' .. base -- than assume it is a template end -- find base template language subpage local page = nilargs.default -- default page if provided or nil otherwise for _, language in ipairs(langList) do if mw.title.new(base .. '/' .. language).exists then page = base .. '/' .. language -- returns only the page break end end assert(page, string.format('No fallback page found for autotranslate (base=[[%s]], lang=%s)', base, args.lang)) -- Transclude {{page |....}} with template arguments the same as the ones passed to {{autotranslate}} template. return frame:expandTemplate{ title = page, args = args} end return p All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://wa.wikisource.org/w/index.php?diff=prev&oldid=2345.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|