A multilingual George?

A forum dedicated to George scripting questions
Post Reply
User avatar
Jeremy Richard
Posts: 53
Joined: 16 Oct 2021, 01:44
Contact:

A multilingual George?

Post by Jeremy Richard »

Could a George script be internationalized natively?

Using "tv_version", something like this can be done to translate a text:

Code: Select all

tv_version
PARSE RESULT software_name software_version language
//tv_warn language

IF CMP(language, fr)
	 my_translated_string = "Bonjour"
END

IF CMP(language, en)
	 my_translated_string = "Hello"
END

IF CMP(language, ja)
	 my_translated_string = "こんにちは"
END

IF CMP(language, zh)
	 my_translated_string = "你好"
END

PRINT my_translated_string
But for things like:
  • date format (22/10/2024 OR 10/22/2024 etc )
  • number (1.000 OR 1,000 etc)
could we have something like this:

Code: Select all

uk_time_format = I18N(DATE, 'en-GB')
usa_time_format = I18N(DATE, 'en-US')
japan_time_format = I18N(DATE, 'ja-JP')
china_time_format = I18N(DATE, 'zh-CN')
-----------------------------------------------------------------------------------------------------------------------

EDIT from 16/11/2024

It is also possible to do the following to translate a text using tv_getlanguage:

Code: Select all

tv_getlanguage
language = RESULT
// tv_warn language

IF CMP(language, french)
	 my_translated_string = "Bonjour"
END

IF CMP(language, english)
	 my_translated_string = "Hello"
END

IF CMP(language, japanese)
	 my_translated_string = "こんにちは"
END

IF CMP(language, chinese)
	 my_translated_string = "你好"
END

PRINT my_translated_string
Last edited by Jeremy Richard on 16 Nov 2024, 11:25, edited 1 time in total.
User avatar
Thierry
Site Admin
Posts: 2780
Joined: 07 Jan 2013, 08:28

Re: A multilingual George?

Post by Thierry »

Hello,

We could maybe add this, but to be honest I don't really see what it would accomplish.
User avatar
Jeremy Richard
Posts: 53
Joined: 16 Oct 2021, 01:44
Contact:

Re: A multilingual George?

Post by Jeremy Richard »

Yes, I don't think I have compelling examples. Maybe when naming files using dates and the local convention, without having to parse and placing the year, month and day in the right order. I can't come up with better than this for now.

I do like the idea though, specially for messages or instructions shown in dialog boxes, so one can share its panel and have it better understood by a wider audience.

Something like this:

Code: Select all

tv_translate 'fr' 'Indiquez le dossier de destination' 'en' 'Select the destination folder'
message = RESULT

tv_reqfile message
Where the right translation shows up according to the language of the software, and could fall back to English when the current language is not available.

But, indeed, it might have very limited use and could be achieved by other means, like using conditions and tv_version for example.
Post Reply