It is currently March 28th, 2024, 12:51 pm

Help for multilingual support

Get help with creating, editing & fixing problems with skins
User avatar
krakoukas
Posts: 71
Joined: December 11th, 2018, 5:56 pm
Location: France
Contact:

Help for multilingual support

Post by krakoukas »

Hi Friends,

What is the best way for multinlingual support in a .rmskin ?

I already have all my language variables in one file and it works fine :

Code: Select all

[Variables]

	; SKIN HEURE
	
		HideSkins = 			"Masquer les Skins"
	
	; SKIN METEO
	
		Weather = 			"Météo à 7 jours"
		Pression = 			"Pression"
		Humidite = 			"Humidité"
		Wind = 				"Vent"
		Visibility = 			"Visibilité"
		DureeDuJour = 			"Durée du Jour"
		LastUpdate = 			"Mise à Jour"

	; SKIN PROCESSUS

		Processus = 			"Processus"
		HDDRead =			"Lecture sur HDD"
		HDDWrite =			"Ecriture sur HDD"

	; SKIN CPU-GPU-RAM-CM

		GeneralView = 			"Ressources Générales, Températures et Ventilations"
		CPU = 				"Processeur"
		GPU = 				"Carte Graphique"
		RAM = 				"Mémoire Vive"
		MB =
This is french. I would like to have english support.
I would like to have only one translation file including FR and ENG if possible (with table ? LUA ????).

Thanks
Last edited by krakoukas on August 9th, 2019, 8:29 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help for multilingual support

Post by balala »

krakoukas wrote: August 9th, 2019, 7:02 pm I would like to have only one translation file including FR and ENG if possible (with table ? LUA ????).
If you want to use both languages, you have to include both language files. Create them and name them as Language1.inc (the French file) and Language2.inc (this will be the English file).
Add a Language variable into the [Variables] section:

Code: Select all

[Variables]
Language=1
The value of this variable controls the language of your skin. It can be either 1 (in this case you get the skin(s) working in French), or 2 (obviously the skin(s) work in English).
Add a @Include option to the [Variables] section:

Code: Select all

[Variables]
...
@Include=Language#Language#.inc
As you can see above, the value of the Language variable controls which file is included into the code of your skin. If the value of the Language variable is set to 1, the French file is included, so all variables included into this file get the French strings. Otherwise, if Language is set to 2, the English file is included, getting the strings in English.
Take care with this method, you can't change the language dynamically. To change the language, you have to modify the Language variable into the [Variables] section and have to refresh the skin.
User avatar
krakoukas
Posts: 71
Joined: December 11th, 2018, 5:56 pm
Location: France
Contact:

Re: Help for multilingual support

Post by krakoukas »

balala wrote: August 9th, 2019, 8:11 pm If you want to use both languages, you have to include both language files. Create them and name them as Language1.inc (the French file) and Language2.inc (this will be the English file).
Thank you Balala, I understand this way, this is not a problem to switch language.
Problem is somewhere else I think. Let's have an example :

Imagine I have a 20 lines French file + its translation, a 20 lines English file.
Now I'm adding another french line in the first French file. We have now a 21 lines French file and a 20 lines Eng file (one missing).
It's impossible to upgrade English file at this point without all erasing : it is only 20 lines instead of 21 and we do not know which one is missing
Hope I managed to share the problem

I was looking for something like this :

Code: Select all

Message1[FR] = "bonjour"
Message1[ENG] = "hello"

Message2[FR] = "merci"
Message2[ENG] = "thank you"

...
Last edited by krakoukas on August 9th, 2019, 8:38 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help for multilingual support

Post by balala »

krakoukas wrote: August 9th, 2019, 8:26 pm Hope I managed to share the problem
No, unfortunately at least from my point of view you didn't.
Why can't you add a new string in both files at the same time: when add a French string, add immediately the English string as well, obviously into the appropriate file?
:confused:
Or you'd like to add the new string into one single file (the French one) and get it translated into the other one (English) automatically?
User avatar
krakoukas
Posts: 71
Joined: December 11th, 2018, 5:56 pm
Location: France
Contact:

Re: Help for multilingual support

Post by krakoukas »

balala wrote: August 9th, 2019, 8:36 pm Why can't you add a new string in both files at the same time: when add a French string, add immediately the English string as well, obviously into the appropriate file?
Because I dont want to manage 2 files. 3, 4, 5 files ?
Only one file, with all languages. Not possible ?
balala wrote: August 9th, 2019, 8:36 pm Or you'd like to add the new string into one single file (the French one) and get it translated into the other one (English) automatically?
Hazardous way but best one btw lol
User avatar
krakoukas
Posts: 71
Joined: December 11th, 2018, 5:56 pm
Location: France
Contact:

Re: Help for multilingual support

Post by krakoukas »

balala wrote: August 9th, 2019, 8:36 pm No, unfortunately at least from my point of view you didn't.
I dont' mind Balala. Find a smart & clever solution with one file or I wont make a Romanian version :D
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help for multilingual support

Post by balala »

krakoukas wrote: August 9th, 2019, 9:01 pm I dont' mind Balala. Find a smart & clever solution with one file or I wont make a Romanian version :D
Yes, I did:
krakoukas wrote: August 9th, 2019, 8:40 pm Because I dont want to manage 2 files. 3, 4, 5 files ?
Only one file, with all languages. Not possible ?
I'd do the followings: first I'd add the Language variable as I described above (doesn't matter if it is added into the included file or the [Variables] section of the skin). Its value controls the language, same way as previously.
Then I'd add two (three, four...) times the same variables, with an index. One variant for each language. For instance:

Code: Select all

HideSkins1=Masquer les Skins
HideSkins2=Hide Skins
As you can see with index 1 you have the French strings, with index 2 the English ones.
Now add the following variable at the end of the language file: HideSkins=[#HideSkins[#Language]].
The HideSkins variable gets its value depending on the value of the Language variable.
krakoukas wrote: August 9th, 2019, 8:40 pm Hazardous way but best one btw lol
I doubt this would be possible!!!
User avatar
krakoukas
Posts: 71
Joined: December 11th, 2018, 5:56 pm
Location: France
Contact:

Re: Help for multilingual support

Post by krakoukas »

balala wrote: August 9th, 2019, 9:08 pm I'd do the followings: first I'd add the Language variable as I described above (doesn't matter if it is added into the included file or the [Variables] section of the skin). Its value controls the language, same way as previously.
Then I'd add two (three, four...) times the same variables, with an index. One variant for each language. For instance:
As always I LOVE YOU so much Balala.
I Promise : Romanian version !

This/your code perfectly works for unique translation file :

Code: Select all

[Variables]

	; Language=FR
	Language=ENG
	
		HideSkinsFR = 								"Masquer les Skins"
		HideSkinsENG = 								"Hide all Skins"
		HideSkins=[#HideSkins[#Language]]
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help for multilingual support

Post by balala »

krakoukas wrote: August 9th, 2019, 9:20 pm This/your code perfectly works for unique translation file :
I'm glad.
Just one more: don't quote the values of the variables, not even if there are spaces into them. It's not needed.
So, instead of HideSkinsFR="Masquer les Skins", use HideSkinsFR=Masquer les Skins.
User avatar
krakoukas
Posts: 71
Joined: December 11th, 2018, 5:56 pm
Location: France
Contact:

Re: Help for multilingual support

Post by krakoukas »

balala wrote: August 10th, 2019, 6:32 am I'm glad.
Just one more: don't quote the values of the variables, not even if there are spaces into them. It's not needed.
So, instead of HideSkinsFR="Masquer les Skins", use HideSkinsFR=Masquer les Skins.
Hi Balala

I'm doing such things because, sometimes in particular, especially during translations, I need white spaces. Let's have a example :

"Volume" in french becomes " Size" with white spaces

Code: Select all

SizeFR = 				"Volume"
SizeENG = 				"       Size"
Size=[#Size[#Language]]
			
SpeedFR = 				"Vitesse"
SpeedENG = 				"Speed"
Speed=[#Speed[#Language]]
			
ClientsFR = 				"Clients"
ClientsENG = 				" Clients"
Clients=[#Clients[#Language]]
			
RatioFR = 				" Ratio"
RatioENG = 				"Ratio"
Ratio=[#Ratio[#Language]]
Post Reply