reading language setting

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


  • If api.util is not defined, then you can't use it. At that time it is very likely you won't have access to them.
    You get the error: attempt to index field 'util' (a nil value)


    This is the reason the commonapi failback ui is always in english.

    I did not found a way to get language at mod.lua loadtime... (this may have changed in the meantime)

  • Have you tried translating a text value and deriving the language from it?

    _("game_language") could e.g. result in "lang_de" or "lang_en". Or do you want a method that is "cleaner"?

    In future versions of my mods this will be used if needed.

  • _() Should work mostly in all states since the summer update.

    I remember a bug report about game_script and translation not working once...


    -edit-

    UGs api functionality is state dependent. Some stuff leaks into the states, so to always be sure to start a fresh exe. As soon as you completely load a savegame, api namespace / functions may support more functionality in a second run.

    Not sure how much UG fixed this until now. UGs Console didn't support translation as example.

  • _() Should work mostly in all states since the summer update.

    I remember a bug report about game_script and translation not working once...

    This is actually also important... with one of my mods such a problem became known once. That's the reason why a default language can be useful, which is always selected if the translation fails. For this purpose, I also have a language setting via the modParams to be able to set a language as default.

    The fact that the translation problem has been fixed in the meantime was unknown to me until now. However, catching possible errors is relatively simple and therefore acceptable to me.


    doug Earlier it was possible to change the language of TF2 via Steam, but this has meanwhile changed and your solution should therefore also work. The effort is greater, however, because as far as I know there is no access to the two files via common ways.