mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-17 03:11:28 +00:00
Update CTLD.lua
Added Russian locale, - my_ctld.locale = "ru"
This commit is contained in:
@@ -1483,6 +1483,7 @@ end
|
|||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
function CTLD:_InitLocalization()
|
function CTLD:_InitLocalization()
|
||||||
self:T(self.lid.."_InitLocalization")
|
self:T(self.lid.."_InitLocalization")
|
||||||
|
self.locale = string.lower(tostring(self.locale or "en"))
|
||||||
self.gettext = TEXTANDSOUND:New("CTLD","en") -- Core.TextAndSound#TEXTANDSOUND
|
self.gettext = TEXTANDSOUND:New("CTLD","en") -- Core.TextAndSound#TEXTANDSOUND
|
||||||
for locale,table in pairs(self.Messages) do
|
for locale,table in pairs(self.Messages) do
|
||||||
local Locale = string.lower(tostring(locale))
|
local Locale = string.lower(tostring(locale))
|
||||||
@@ -1495,6 +1496,20 @@ function CTLD:_InitLocalization()
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function CTLD:_GetMenuPluralSuffix(Count, Kind)
|
||||||
|
local count = tonumber(Count) or 0
|
||||||
|
if self.locale == "ru" then
|
||||||
|
local n = math.abs(count) % 100
|
||||||
|
local d = n % 10
|
||||||
|
if n >= 11 and n <= 14 then return "ов" end
|
||||||
|
if d == 1 then return "" end
|
||||||
|
if d >= 2 and d <= 4 then return "а" end
|
||||||
|
return "ов"
|
||||||
|
end
|
||||||
|
if self.locale == "de" and Kind == "crate" then return count > 1 and "n" or "" end
|
||||||
|
return count > 1 and "s" or ""
|
||||||
|
end
|
||||||
|
|
||||||
--- [User] Set SRS TTS details - see @{Sound.SRS} for details.`SetSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
--- [User] Set SRS TTS details - see @{Sound.SRS} for details.`SetSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
-- @param #number Frequency Frequency to be used. Can also be given as a table of multiple frequencies, e.g. 30 or {30,124.5}. Defaults to {30,124.5}. There needs to be exactly the same number of modulations!
|
-- @param #number Frequency Frequency to be used. Can also be given as a table of multiple frequencies, e.g. 30 or {30,124.5}. Defaults to {30,124.5}. There needs to be exactly the same number of modulations!
|
||||||
@@ -6808,8 +6823,7 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local txt
|
local txt
|
||||||
local cargoLabel = self:_GetCargoDisplayName(cargoObj)
|
local cargoLabel = self:_GetCargoDisplayName(cargoObj)
|
||||||
if needed > 1 then
|
if needed > 1 then
|
||||||
local plural = "s"
|
local plural = self:_GetMenuPluralSuffix(needed, "crate")
|
||||||
if self.locale == "de" then plural = "n" end
|
|
||||||
txt = string.format(self.gettext:GetEntry("MENU_CRATES_NEEDED",self.locale),needed,plural,cargoLabel,cargoObj.PerCrateMass or 0)
|
txt = string.format(self.gettext:GetEntry("MENU_CRATES_NEEDED",self.locale),needed,plural,cargoLabel,cargoObj.PerCrateMass or 0)
|
||||||
else
|
else
|
||||||
txt = string.format("%s (%dkg)",cargoLabel,cargoObj.PerCrateMass or 0)
|
txt = string.format("%s (%dkg)",cargoLabel,cargoObj.PerCrateMass or 0)
|
||||||
@@ -6859,8 +6873,7 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local txt
|
local txt
|
||||||
local cargoLabel = self:_GetCargoDisplayName(cargoObj)
|
local cargoLabel = self:_GetCargoDisplayName(cargoObj)
|
||||||
if needed > 1 then
|
if needed > 1 then
|
||||||
local plural = "s"
|
local plural = self:_GetMenuPluralSuffix(needed, "crate")
|
||||||
if self.locale == "de" then plural = "n" end
|
|
||||||
txt = string.format(self.gettext:GetEntry("MENU_CRATES_NEEDED",self.locale),needed,plural,cargoLabel,cargoObj.PerCrateMass or 0)
|
txt = string.format(self.gettext:GetEntry("MENU_CRATES_NEEDED",self.locale),needed,plural,cargoLabel,cargoObj.PerCrateMass or 0)
|
||||||
else
|
else
|
||||||
txt = string.format("%s (%dkg)",cargoLabel,cargoObj.PerCrateMass or 0)
|
txt = string.format("%s (%dkg)",cargoLabel,cargoObj.PerCrateMass or 0)
|
||||||
@@ -6877,8 +6890,7 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local txt
|
local txt
|
||||||
local cargoLabel = self:_GetCargoDisplayName(cargoObj)
|
local cargoLabel = self:_GetCargoDisplayName(cargoObj)
|
||||||
if needed > 1 then
|
if needed > 1 then
|
||||||
local plural = "s"
|
local plural = self:_GetMenuPluralSuffix(needed, "crate")
|
||||||
if self.locale == "de" then plural = "n" end
|
|
||||||
txt = string.format(self.gettext:GetEntry("MENU_CRATES_NEEDED",self.locale),needed,plural,cargoLabel,cargoObj.PerCrateMass or 0)
|
txt = string.format(self.gettext:GetEntry("MENU_CRATES_NEEDED",self.locale),needed,plural,cargoLabel,cargoObj.PerCrateMass or 0)
|
||||||
else
|
else
|
||||||
txt = string.format("%s (%dkg)",cargoLabel,cargoObj.PerCrateMass or 0)
|
txt = string.format("%s (%dkg)",cargoLabel,cargoObj.PerCrateMass or 0)
|
||||||
@@ -6896,8 +6908,7 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local txt
|
local txt
|
||||||
local cargoLabel = self:_GetCargoDisplayName(cargoObj)
|
local cargoLabel = self:_GetCargoDisplayName(cargoObj)
|
||||||
if needed > 1 then
|
if needed > 1 then
|
||||||
local plural = "s"
|
local plural = self:_GetMenuPluralSuffix(needed, "crate")
|
||||||
if self.locale == "de" then plural = "n" end
|
|
||||||
txt = string.format(self.gettext:GetEntry("MENU_CRATES_NEEDED",self.locale),needed,plural,cargoLabel,cargoObj.PerCrateMass or 0)
|
txt = string.format(self.gettext:GetEntry("MENU_CRATES_NEEDED",self.locale),needed,plural,cargoLabel,cargoObj.PerCrateMass or 0)
|
||||||
else
|
else
|
||||||
txt = string.format("%s (%dkg)",cargoLabel,cargoObj.PerCrateMass or 0)
|
txt = string.format("%s (%dkg)",cargoLabel,cargoObj.PerCrateMass or 0)
|
||||||
@@ -6914,8 +6925,7 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local txt
|
local txt
|
||||||
local cargoLabel = self:_GetCargoDisplayName(cargoObj)
|
local cargoLabel = self:_GetCargoDisplayName(cargoObj)
|
||||||
if needed > 1 then
|
if needed > 1 then
|
||||||
local plural = "s"
|
local plural = self:_GetMenuPluralSuffix(needed, "crate")
|
||||||
if self.locale == "de" then plural = "n" end
|
|
||||||
txt = string.format(self.gettext:GetEntry("MENU_CRATES_NEEDED",self.locale),needed,plural,cargoLabel,cargoObj.PerCrateMass or 0)
|
txt = string.format(self.gettext:GetEntry("MENU_CRATES_NEEDED",self.locale),needed,plural,cargoLabel,cargoObj.PerCrateMass or 0)
|
||||||
else
|
else
|
||||||
txt = string.format("%s (%dkg)",cargoLabel,cargoObj.PerCrateMass or 0)
|
txt = string.format("%s (%dkg)",cargoLabel,cargoObj.PerCrateMass or 0)
|
||||||
@@ -7564,7 +7574,7 @@ function CTLD:_RefreshDropCratesMenu(Group, Unit)
|
|||||||
end,self,Group,Unit,cName,needed,1)
|
end,self,Group,Unit,cName,needed,1)
|
||||||
else
|
else
|
||||||
for q=1,sets do
|
for q=1,sets do
|
||||||
local qm=MENU_GROUP:New(Group,string.format(self.gettext:GetEntry("MENU_DROP_N_SETS",self.locale),q,q>1 and "s" or ""),parentMenu)
|
local qm=MENU_GROUP:New(Group,string.format(self.gettext:GetEntry("MENU_DROP_N_SETS",self.locale),q,self:_GetMenuPluralSuffix(q, "set")),parentMenu)
|
||||||
--local qm=MENU_GROUP:New(Group,string.format("Drop %d Set%s",q,q>1 and "s" or ""),parentMenu)
|
--local qm=MENU_GROUP:New(Group,string.format("Drop %d Set%s",q,q>1 and "s" or ""),parentMenu)
|
||||||
MENU_GROUP_COMMAND:New(Group,self.gettext:GetEntry("MENU_DROP",self.locale),qm,function(selfArg,GroupArg,UnitArg,cNameArg,neededArg,qty)
|
MENU_GROUP_COMMAND:New(Group,self.gettext:GetEntry("MENU_DROP",self.locale),qm,function(selfArg,GroupArg,UnitArg,cNameArg,neededArg,qty)
|
||||||
local uName=UnitArg:GetName()
|
local uName=UnitArg:GetName()
|
||||||
@@ -7661,7 +7671,7 @@ function CTLD:_RefreshDropCratesMenu(Group, Unit)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
for q=1,sets do
|
for q=1,sets do
|
||||||
local qm=MENU_GROUP:New(Group,string.format(self.gettext:GetEntry("MENU_DROP_N_SETS",self.locale),q,q>1 and "s" or ""),parentMenu)
|
local qm=MENU_GROUP:New(Group,string.format(self.gettext:GetEntry("MENU_DROP_N_SETS",self.locale),q,self:_GetMenuPluralSuffix(q, "set")),parentMenu)
|
||||||
--local qm=MENU_GROUP:New(Group,string.format("Drop %d Set%s",q,q>1 and "s" or ""),parentMenu)
|
--local qm=MENU_GROUP:New(Group,string.format("Drop %d Set%s",q,q>1 and "s" or ""),parentMenu)
|
||||||
MENU_GROUP_COMMAND:New(Group,self.gettext:GetEntry("MENU_DROP",self.locale),qm,function(selfArg,GroupArg,UnitArg,cNameArg,neededArg,qty)
|
MENU_GROUP_COMMAND:New(Group,self.gettext:GetEntry("MENU_DROP",self.locale),qm,function(selfArg,GroupArg,UnitArg,cNameArg,neededArg,qty)
|
||||||
local uName=UnitArg:GetName()
|
local uName=UnitArg:GetName()
|
||||||
|
|||||||
Reference in New Issue
Block a user