Localization part 2 (#332)
* More localization work * instance testing translation * Row cell translations * safety check
This commit is contained in:
1 parent
48993dd9f5
commit
9a7db6aab2
27 files changed
+1201
-270
No files matched your search
@@ -0,0 +1,46 @@
|
||||
' TODO:P2 Translations left
|
||||
' - Some error messages
|
||||
' - Settings file
|
||||
' - Remote screen
|
||||
' - Web app
|
||||
' - Loading messages
|
||||
|
||||
import "pkg:/source/utils/MathUtils.bs"
|
||||
|
||||
namespace LocaleUtils
|
||||
|
||||
function GetPluralString(c as integer, zeroString as string, oneString as string, pluralString as string) as string
|
||||
if c = 0
|
||||
return Tr(zeroString)
|
||||
else if c = 1
|
||||
return Tr(oneString)
|
||||
else
|
||||
return Tr(pluralString).Replace("^n", c.toStr())
|
||||
end if
|
||||
end function
|
||||
|
||||
function GetFormattedPluralString(c as integer, zeroString as string, oneString as string, pluralString as string) as string
|
||||
if c = 0
|
||||
return Tr(zeroString)
|
||||
else if c = 1
|
||||
return Tr(oneString)
|
||||
else
|
||||
if c < 1000
|
||||
return Tr(pluralString).Replace("^n", MathUtils.FormatFloat(c).toStr())
|
||||
end if
|
||||
c = c / 1000
|
||||
if c < 1000
|
||||
return Tr(pluralString).Replace("^n", MathUtils.FormatFloat(c).toStr() + "K")
|
||||
end if
|
||||
|
||||
c = c / 1000
|
||||
if c < 1000
|
||||
return Tr(pluralString).Replace("^n", MathUtils.FormatFloat(c).toStr() + "M")
|
||||
end if
|
||||
|
||||
c = c / 1000
|
||||
return Tr(pluralString).Replace("^n", MathUtils.FormatFloat(c).toStr() + "B")
|
||||
end if
|
||||
end function
|
||||
|
||||
end namespace
|
||||
Reference in new issue
Block a user