Difference between revisions of "Lng2 File usage"

From Nexus Mods Wiki
Jump to: navigation, search
(Created page with "lng2 files or lang files are used for localization. Mostly found in Assets\tpp\pack\ui\lang\lang_default_data_<language>.fpk Language codes - eng,fre,ger,ita,jpn,por,rus,spa l...")
 
Line 23: Line 23:
 
In lua a string is hashed using the engine function Fox.StrCode32(string)
 
In lua a string is hashed using the engine function Fox.StrCode32(string)
  
Supports string formatting characters, but what it will accept seems dependant on the function. AnnounceLogViewLangId will only accept the string, number, or number, number as it's paramaters, other combinations lock the game up.
+
Supports string formatting characters, in the above entries seen as %s for another langId, %d for a number.
 +
 
 +
What it will accept however seems dependent on the function. AnnounceLogViewLangId will only accept the string, number, or number, number as it's paramaters, other combinations lock the game up.
  
 
Evidence from other localization strings in lng2 files suggest other functions are less restricted.
 
Evidence from other localization strings in lng2 files suggest other functions are less restricted.

Revision as of 01:57, 26 October 2015

lng2 files or lang files are used for localization. Mostly found in Assets\tpp\pack\ui\lang\lang_default_data_<language>.fpk

Language codes - eng,fre,ger,ita,jpn,por,rus,spa


lng2 files be converted to and from editable xml files using LangTool

The converted lng2 xml localization string entries will look like:

<Entry Key="956942769" Value="Obtained Poster [%s] [GMP +%d]" />

<Entry Key="4191827342" Value="Soviet Soldier" />

The Key is a CityHash64WithSeeds of the lua key string, most commonly reffered to at langId in the lua scripts.

See StrCode32 Tool Source to generate hashes.

Provide it with a text file of strings (1 per line) and it will output same list with hashes appended.

In lua a string is hashed using the engine function Fox.StrCode32(string)

Supports string formatting characters, in the above entries seen as %s for another langId, %d for a number.

What it will accept however seems dependent on the function. AnnounceLogViewLangId will only accept the string, number, or number, number as it's paramaters, other combinations lock the game up.

Evidence from other localization strings in lng2 files suggest other functions are less restricted.

In the above entries the langId/Keys resolve from:

announce_get_gravure and key_poster_3500

Lua usage:

TppUICommand.AnnounceLogViewLangId("announce_get_gravure","key_poster_3500",500)

If a langId is called without a matching entry in the particular language lang file it will return empty.

Fox engine will load all lng2 files from a pack enabling addition of completley new .lng2 files.