Page 2 of 2

Re: Help for multilingual support

Posted: August 10th, 2019, 1:18 pm
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.

Re: Help for multilingual support

Posted: August 10th, 2019, 1:53 pm
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.

Re: Help for multilingual support

Posted: August 10th, 2019, 1:57 pm
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?

Re: Help for multilingual support

Posted: August 10th, 2019, 2:05 pm
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.