Modül:LangSwitch
-- \/ ___ __ _ _ ___ _ __ _ _ __ __ _/ ___ _ _(_) _ ___ __ \/ / _ \ / _` / _ (_) / _` '_ \ / _` \___ \ \ /\ / / __/ __ '_ \ (_) (_ _ __/_ __ (_ (_ ___) \ V V / (__ _ _ \___/ \__,_ \__,_ _ \___(_)_____\__,_ _ _ \__, ____/ \_/\_/ _ \__\___ _ _ ___/ Authors and maintainers: User:Zolo - original version in Module:Fallback User:Jarekt -- add optional module -- used for debugging purposes as it detects cases of unintended global variables
local p = {}
--
_langSwitch This function is the core part of the LangSwitch template. Example usage from Lua:
text = _langSwitch({en='text in english', pl='tekst po polsku'}, lang) Parameters: args - table with translations by language lang - desired language (often user's native language) Error Handling:
function p. _langSwitch(args, lang) -- args: table of translations -- Return error if there is not default and no english version if not args.