localexport={}localWikimediaLanguage={}functionWikimediaLanguage:getCode()returnself._codeendfunctionWikimediaLanguage:getCanonicalName()returnself._rawData.canonicalNameend--function WikimediaLanguage:getAllNames()-- return self._rawData.names--endfunctionWikimediaLanguage:getType()return"Wikimedia"endfunctionWikimediaLanguage:getWiktionaryLanguage()ifnotself._wiktionaryLanguageObjectthenself._wiktionaryLanguageObject=require("Module:languages").getByCode(self._rawData.wiktionary_code)endreturnself._wiktionaryLanguageObjectend-- Do NOT use this method!-- All uses should be pre-approved on the talk page!functionWikimediaLanguage:getRawData()returnself._rawDataendWikimediaLanguage.__index=WikimediaLanguagefunctionexport.getByCode(code)-- Only accept codes the software recognisesifnotmw.language.isKnownLanguageTag(code)thenreturnnilendlocalrawData=mw.loadData("Module:wikimedia languages/data")[code]-- If there is no specific Wikimedia code, then "borrow" the information-- from the general Wiktionary language codeifnotrawDatathenlocallang=require("Module:languages").getByCode(code)ifnotlangthenreturnnilendrawData={canonicalName=lang:getCanonicalName(),wiktionary_code=code}elseifnotrawData.canonicalNamethenrawData={canonicalName=require("Module:languages").getByCode(rawData.wiktionary_code):getCanonicalName(),wiktionary_code=rawData.wiktionary_code}endreturnsetmetatable({_rawData=rawData,_code=code},WikimediaLanguage)endfunctionexport.getByCodeWithFallback(code)localobject=export.getByCode(code)ifobjectthenreturnobjectendlocallang=require("Module:languages").getByCode(code)ifnotlangthenreturnnilendreturnlang:getWikimediaLanguages()[1]endreturnexport