Hi to all and thanks for the help given!
This is a guide about how translate/interact with Factorio locale files.
------------------------------------------------------------------------
First part - File format
Factorio format the locale files with ini format:
https://en.wikipedia.org/wiki/INI_file
Each language is divided in a different INI file in a different folder with named with the first two letter prefix of language.
Localization files can be half completed, so the game don't need the full file for localize a part of strings.
All texts/strings are divided in categories (incapsulated in two square brackets) and identified by a name, for example all items have two category:
[item-name]
[item-description]
First is mandatory, the second one is optional.
As you can guess one is for names one is of descriptions, the result is something like:
[item-name]
iron-plate=iron plate
copper-plate=Copper plate
[item-description]
iron-plate=A plate produced by iron ore
copper-plate=A plate produced by copper ore
Each item string must have the name (internal name for Factorio not for users) of the object followed by a equal and without spaces the string:
a=texts/strings(never start new line! All string is one one line!)
The spaces or tab before "a" will be ignored.
CAN EXIST ONLY ONE ENTRY FOR CATEGORY, THIS:
[item-name]
a=texts1/strings1
a=texts2/strings2
WILL MAKE FACTORIO CRASH!
Here there's the link to the official localization guide:
https://wiki.factorio.com/Tutorial:Localisation
------------------------------------------------------------------------
Second part - Localized special strings
Also in localized texts/strings can be found some special sub-strings:
__1__
__ITEM__iron-plate__
__CONTROL__open-technology-gui__
__plural_for_parameter_1_{1=day|rest=days}__
They are special sub-strings that must be leaved untouched, except for plural_for_parameter, in this case must be translate the part {1=one potato|2=two potato|rest=many potato} each entry separeted by | character is a possible string that can be used. In particular:
__1__ is a place for insert words via code:
[other]
counter=I have count __1__ potato.
Later in code:
game.print({"other.counter", 4})
Will print
...
I have count 4 potato!
...
Also:
[other]
counter=I have count __1__ __plural_for_parameter_1_{1=potato|rest=potatoes}__.
Later in code:
game.print({"other.counter", 1})
game.print({"other.counter", 4})
Will print
...
I have count 1 potato!
I have count 4 potatoes!
...
Instead __ITEM__a__ __CONTROL__b__ (__CONTROL__ is for hotkeys only) is fixed replacer, will place in that part of the localized string associeted with that like:
[item-name]
iron-ore=Raw iron ore
iron-plate=Iron plate
copper-plate=Copper plate
[item-description]
iron-plate=A plate produced by __ITEM__iron-ore__
... later in game...
A plate produced by Raw iron ore
Here too can be found information about:
https://wiki.factorio.com/Tutorial:Localisation
------------------------------------------------------------------------
Third part - Rich text
In some strings can be found some "tags" different from built-in parameters, because factorio support some of rich text metatag, used in the strings to add some information that can't be done otherwise, like bold text part, text color...
The tree more important is:
[color=rgb]...[/color]
[font=font-name]...[/font]
[img=class/name][item=name][fluid=name][entity=name]
All start with [...] and finish with [/...], if [/...] will not writed the tag will work for all string from that point.
Color is for color a part of text, font is for give a special font effect:
https://wiki.factorio.com/Data.raw#font
And img/item/fluid/entity is for show in the text the icon of that object.
Here there's the official guide of rich text for Factorio:
https://wiki.factorio.com/Rich_text
------------------------------------------------------------------------