Page 1 of 1

Language tag for Player.request_translation

Posted: Mon Sep 23, 2019 11:21 am
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

Re: Language tag for Player.request_translation

Posted: Thu Sep 26, 2019 1:48 pm
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