Lng2 File usage

From Nexus Mods Wiki
Revision as of 14:05, 15 November 2018 by Pickysaurus (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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 LangId="announce_get_gravure" Color="5" Value="Obtained Poster [%s] [GMP +%d]" />

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

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

LangTool supports a dictionary of langIds, and the LangId attribute on the first entry is the result of using the dictionary.

You can get the dictionary from here: https://github.com/cstBipBop/MGSV-Lang-Dictionary-Project

The second entry langId actually resolves from key_poster_3500, but was omitted from the dictionary for this example.

In lua a string may be hashed using the engine function Fox.StrCode32(string), though there it's mostly used for indexing and engine functions that take langIds do the hashing internally.

Localization strings support 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 two numbers as it's parameters, other combinations lock the game up.

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

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 completely new .lng2 files.