Module:languages៖ ភាពខុសគ្នារវាងកំណែនានា

ខ្លឹមសារដែលបានលុបចោល ខ្លឹមសារដែលបានសរសេរបន្ថែម
No edit summary
No edit summary
បន្ទាត់ទី១០៖
 
function Language:getCanonicalName()
return self._rawData.names[1]canonicalName
end
 
 
-- Commented out; I don't think anything uses this, the presence/absence of script errors should confirm
--function Language:getAllNames()
-- return self._rawData.names
end
--end
 
 
function Language:getOtherNames()
return self._rawData.otherNames or {}
if not self._otherNames then
self._otherNames = {}
for i, val in ipairs(self._rawData.names) do
if i > 1 then
table.insert(self._otherNames, val)
end
end
end
return self._otherNames
end
 
Line ៥១ ⟶ ៤២:
return self._wikimediaLanguageObjects
end
 
 
function Language:getWikipediaArticle()
return self._rawData.wikipedia_article or self:getCategoryName()
end
 
Line ១០២ ⟶ ៩៨:
return self._ancestorChain
end
 
 
function Language:hasAncestor(otherlang)
local ancestors = self:getAncestorChain()
for i_, valancestor in ipairs(self._rawData.namesancestors) do
if ancestor:getCode() == otherlang:getCode() then
return true
end
end
return false
end
 
 
function Language:getCategoryName()
local name = self._rawData.names[1]canonicalName
-- If the name already has "language" in it, don't add it.
Line ១១៩ ⟶ ១២៨:
function Language:makeEntryName(text)
text = mw.ustring.gsub(text, "^[¿¡]", "")
text = mw.ustring.gsub(text, "(.)[؟?!;՛՜ ՞ ՟?!।॥။၊་།]$", "%1")
if self._rawData.entry_name then
Line ១៣៨ ⟶ ១៤៧:
name = mw.ustring.gsub(name, "^[-־ـ*]+(.)",
"%1")
-- Remove anything in parentheses, as long as they are either preceded or followed by something
name = mw.ustring.gsub(name, "(.)%([^()]+%)", "%1")
name = mw.ustring.gsub(name, "%([^()]+%)(.)", "%1")
-- If there are language-specific rules to generate the key, use those