It is currently March 28th, 2024, 11:43 pm

StringCase option Tooltip

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: StringCase option Tooltip

Post by balala »

Yincognito wrote: February 10th, 2020, 7:02 pm If only the PCRE regex in Rainmeter would be the "extended" one. Apparently, according to Regular-Expression, case conversion is possible in the extended version of PCRE2. Even so, I'm not sure it would work for all letters in other languages, so it seems Lua is the only solution for this at this time...
In my above code the case conversion isn't done by lua, but by a String measure. I think this is a better (or simpler?) solution, because xenium asked ONLY to convert AM / PM to lower case. Obviously if there can be any string besides AM / PM, it's quite more complicated.
Yincognito wrote: February 10th, 2020, 7:02 pm Me, I won't bother with localized weather strings. I never did, and I never will. I also use tooltips extensively in my skins and for visual formatting purposes, having a ton of languages to display data in tooltips would be a disaster. I barely managed to make string right align and have the exact length on each tooltip row in English - doing that in other languages would take months and lot of effort to get it right...
Yes, maybe you don't, however since the provider offers the translated strings as well and many people do care, it is always a better idea in my opinion, to create from the beginning a way to can use localized strings. But obviously it's up to every author how he / she wants to write his / her code.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: StringCase option Tooltip

Post by Yincognito »

balala wrote: February 10th, 2020, 7:18 pmYes, maybe you don't, however since the provider offers the translated strings as well and many people do care, it is always a better idea in my opinion, to create from the beginning a way to can use localized strings. But obviously it's up to every author how he / she wants to write his / her code.
I never said it shouldn't be done. I only said it's an impractical choice when it comes to tooltips (unless we tak about very simple ones). For more options and more complex scenarios, using localized strings should preferably be done in the skin itself.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: StringCase option Tooltip

Post by xenium »

balala wrote: February 10th, 2020, 6:30 pm I doubt a .lua script would be needed. A String measure is enough, as far as I can tell:

Code: Select all

[MeasureToolTip]
Measure=String
String=[MeasureString]
RegExpSubstitute=1
Substitute="(?i)am([^a-zA-Z0-9])":"am\1","(?i)pm([^a-zA-Z0-9])":"pm\1"
DynamicVariables=1

[MeasureString]
Measure=String
String=...

[MeterString]
Meter=String
MeasureName=MeasureString
...
ToolTipText=[MeasureToolTip]
:thumbup:
Thanks
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: StringCase option Tooltip

Post by balala »

xenium wrote: February 10th, 2020, 9:11 pm :thumbup:
Thanks
Does this mean my approach proofed to be good?
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: StringCase option Tooltip

Post by xenium »

balala wrote: February 10th, 2020, 9:38 pm Does this mean my approach proofed to be good?
Yes
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: StringCase option Tooltip

Post by balala »

xenium wrote: February 10th, 2020, 9:50 pmYes
:thumbup: