It is currently October 1st, 2020, 5:45 am

Help for multilingual support

Help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 21398
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help for multilingual support

Post by jsmorley »

krakoukas wrote: August 10th, 2019, 12:58 pm 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]]
Yes, the way it works is that when any option value is evaluated, it first gets the string value, then throws away any starting and ending quotes. In general, you never need to put quotes on any string values in options. However, leading and trailing spaces and/or tabs in option values are always ignored, unless they are clearly defined as a part of the string value, by enclosing them in quotes.

So:

Code: Select all

[Variables]
myText=          Some Text
Would end up just being Some Text when used in a meter, but:

Code: Select all

[Variables]
myText="          Some Text"
Would end up being       Some Text.

Just to ensure that the whole "quotes" thing is as confusing as possible... ;-)

It works this way so that when folks want to format their code with "white space", like

Code: Select all

FontSize   =    12
FontColor  =    255,255,255,255
which I HATE...

The trailing spaces on the option name and the leading spaces on the option value are not taken into account and cause problems. Rainmeter in general ignores leading and trailing spaces and tabs in options.
User avatar
balala
Rainmeter Sage
Posts: 11458
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help for multilingual support

Post by balala »

EDIT: Sorry jsmorley, you beat me. Again!
krakoukas wrote: August 10th, 2019, 12:58 pm I'm doing such things because, sometimes in particular, especially during translations, I need white spaces.
Ok, no problem even if they are quoted. I just post this advice anytime I see those quotations, because they are not needed. But if you want to begin a variable with space, the quotation marks become inevitable.
User avatar
balala
Rainmeter Sage
Posts: 11458
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help for multilingual support

Post by balala »

jsmorley wrote: August 10th, 2019, 1:18 pm The trailing spaces on the option name and the leading spaces on the option value are not taken into account and cause problems.
Although I really hate them as well, I don't think they would cause problems. What kind of problems are they causing?
User avatar
jsmorley
Developer
Posts: 21398
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help for multilingual support

Post by jsmorley »

balala wrote: August 10th, 2019, 1:57 pm Although I really hate them as well, I don't think they would cause problems. What kind of problems are they causing?
None, because we ignore them.