Language tag for Player.request_translation

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Helfima
Fast Inserter
Fast Inserter
Posts: 199
Joined: Tue Jun 28, 2016 11:40 am
Contact:

Language tag for Player.request_translation

Post by Helfima »

Hello
after use Player.request_translation, if we could know what language is request or what language is use by requester player ?
I don't know is possible but for example me I'm French if I can know my language is "fr" in game, that would be complementary of Player.request_translation

in the player instance:

Code: Select all

Player.language_tag :: string
in the result of request:

Code: Select all

player_index :: uint
localised_string :: LocalisedString
language_tag :: string
result :: string
translated :: boolean
if we store the request in the global we can store by User but store by language is better, we can reduce request and the storage size.

actualy:

Code: Select all

global.user1[localised_string]=en_translated_string
global.user2[localised_string]=en_translated_string
global.user3[localised_string]=fr_translated_string
idea:

Code: Select all

global.en[localised_string]=en_translated_string
global.fr[localised_string]=fr_translated_string

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Language tag for Player.request_translation

Post by eradicator »

+10

Code: Select all

LuaPlayer.language_iso_name [R]
Having it in every event is redundant because it doesn't change during runtime, only in on_player_joined (not sure how to handle that in singleplayer...).

A method without additional functions would be to add the name of the locale to the locale itself. It would also be useful to have the actual name translated to give players the option to chose their language from a drop-down menu or similar.

Code: Select all

;locale.cfg
[locale]
name=en
localised-name=English
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Modding interface requests”