Instructions
Infinitode 2 uses localization features of LibGDX but is also able to include strings into other strings with [@other_string_alias] and icon textures with <@texture-name>
Things it can't do:
- Format values according to the gender
- Country-specific number formating - all numbers use . as a decimal separator (because programming languages do that) and , as a thousands separator for readability (space is not used because it may lead to unwanted line breaks)
- Turn strings into upper / lower case or switch the case of individual letters
Sorry. If you have any idea of how to improve the translations, please write them on our Discord server and ping me.
Tags explained:
- <@texture-name> - will be replaced with a small texture of the same name.
- [#RRGGBB] or [COLOR] - switches color of the text, see LibGDX's Color Markup Language (not a language actually, just a type of a tag).
- [@other_string_alias] - will be replaced with a string which has the alias specified. The included string is already translated into the same language.
- {0} or {1} or {0,number} etc. - are kind of a variables that will be replaced by the game. Explained here and there, but I'll try to make a cheat sheet which is easier to understand (find it below)
Format tags ({0-9}) cheat sheet
Each format tag is encapsulated into {} and the first thing inside of it is a digit from 0 to 9, which is basically a name of a variable (actually it is called an index of an argument but whatever).
For example, if we take a string "Tower deals {0} damage and costs {1} coins", the game will replace {0} with some damage number and {1} with the cost of the tower. If we swap those tags, the resulting string will no longer make a sense, so it is important to pay attention to what each variable means.
Note: variable {0} is used in the list below but it can be anything like {1}/{4}... too.
- {0} - inserts value as-is, the most common tag you'll find
- {0,number} / {0,number,integer} etc. - inserts value as a number, and you should only use such type of tags only if they exist in the original (English) pattern.
- {0,date,...} / {0,time,...} - while MessageFormat allows this, date and time tags are never used by the game in a form suitable for this type of a tag. Just avoid and forget them.
- {0,choice,...} - allows to insert some value depending on the numeric value of the variable - the most common use case is handling of plurals. It can be used to insert the variable itself or any custom text you specify - basically it is a simple "if" statement.
Such tags always start with {0,choice, and then goes the list of "conditions", separated by the | symbol. Conditions can be specified like this:
- 1#one - if # is used, the variable will be compared to the left part (1 in this case) and only if it matches, the right part will be printed (one).
- 1<many - in this case, < means that condition requires the variable to be greater than 1, which will insert the right part (many) for 2,3,4... and anything larger than that.
- It does not work with >, all conditions must be specified from small to large.
- 2<{0} items - you can also insert format tags into the right part of conditions to print actual variables there.
Some examples:
- {0,choice,1#One apple|2#Two apples|2<Three or more apples}
- {0,choice,1#One apple|2#Two apples|2<{0} apples}
- {0,choice,1#One apple|1<Few apples|5<Many apples|100<Shitload of apples}
Don't make format tags more specific when you print them as a number - if the original tag is {0}, leave it as {0} even if you think it should be a {0,number,integer} or something else.
The reason is, variables are not always numbers even if they look like numbers in the result. The game pre-formats numbers in many strings and inserts them as a string, which will not work if you try to format them as a number.