Difference between revisions of "Lng2 File usage"

From Nexus Mods Wiki
Jump to: navigation, search
m
 
(2 intermediate revisions by 2 users not shown)
Line 21: Line 21:
 
You can get the dictionary from here: https://github.com/cstBipBop/MGSV-Lang-Dictionary-Project
 
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 ommitted from the dictionary for this example.
+
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.
 
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.
Line 27: Line 27:
 
Localization strings support string formatting characters, in the above entries seen as %s for another langId, %d for a number.  
 
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 number, number as it's paramaters, other combinations lock the game up.
+
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.
 
Evidence from other localization strings in lng2 files suggest other functions are less restricted.
Line 39: Line 39:
 
If a langId is called without a matching entry in the particular language lang file it will return empty.
 
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.
+
Fox engine will load all lng2 files from a pack enabling addition of completely new .lng2 files.
 
[[Category:Metal Gear Solid 5]]
 
[[Category:Metal Gear Solid 5]]
[[Category:The Phantom Pain]]
 
 
[[Category:Lua]]
 
[[Category:Lua]]
[[Category:File usage]]
+
[[Category:Scripting]]
 +
[[Category: Mod Creation]]

Latest revision as of 14:05, 15 November 2018

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.