Changes

Add translation variation support
Line 1: Line 1:  
local BaseData = require("Module:BaseData")
 
local BaseData = require("Module:BaseData")
 
local EquipmentData = BaseData({
 
local EquipmentData = BaseData({
 +
_strict_translation_class = "strict-translation",
 +
_common_translation_class = "common-translation",
 +
_mobile_hide_class = "mobile-hide",
 +
_display_none_css = {display = "none"},
 
_equipment_compatibility = {
 
_equipment_compatibility = {
 
[1] = {
 
[1] = {
Line 931: Line 935:  
function EquipmentData:name()
 
function EquipmentData:name()
 
return self._name
 
return self._name
 +
end
 +
 +
function EquipmentData:common_name()
 +
return self._common_name
 +
end
 +
 +
function EquipmentData:base_name()
 +
return self._base_name or self:name()
 
end
 
end
   Line 1,138: Line 1,150:  
setmetatable(equip, equip)
 
setmetatable(equip, equip)
 
equip.__index = self
 
equip.__index = self
 +
if equip._common_name then
 +
equip._base_name = equip._name
 +
equip._name = tostring(mw.html.create('span'):addClass(self._mobile_hide_class):addClass(self._strict_translation_class):css(self._display_none_css):wikitext(equip._name))
 +
.. tostring(mw.html.create('span'):addClass(self._common_translation_class):wikitext(equip._common_name))
 +
end
 
return equip
 
return equip
 
end
 
end
Anonymous user