Hi,
Can I use StringCase=Proper for the tooltip ?
Thanks
It is currently April 28th, 2024, 12:24 pm
StringCase option Tooltip
-
- Posts: 868
- Joined: January 4th, 2018, 9:52 pm
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: StringCase option Tooltip
No, you can't. I think that would take some Inline Lua to accomplish.
-
- Posts: 868
- Joined: January 4th, 2018, 9:52 pm
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: StringCase option Tooltip
So like this:
Test.lua:
When using global substitute gsub(), the character class %S in Lua pattern matching simply means "not a space or tab".
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
[Lua]
Measure=Script
ScriptFile=#CURRENTPATH#Test.lua
Disabled=1
[MeasureString]
Measure=String
String=hello world
[MeterString]
Meter=String
MeasureName=MeasureString
FontSize=15
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
StringCase=Upper
DynamicVariables=1
ToolTipText=[&Lua:ProperCase('[&MeasureString]')]
Code: Select all
function ProperCase(inArg)
return (inArg:gsub('(%S)(%S*)', function(first, rest) return first:upper() .. rest:lower() end))
end
When using global substitute gsub(), the character class %S in Lua pattern matching simply means "not a space or tab".
You do not have the required permissions to view the files attached to this post.
-
- Posts: 868
- Joined: January 4th, 2018, 9:52 pm
Re: StringCase option Tooltip
Good thing there is a solution using Lua.
I add in the W10WEnterp skin and the phases of the Moon, and in other languages the first letter is lowercase.
But now I noticed that in some languages the translation also contains prepositions and these should be lowercase.
So I leave the translation as is.
I add in the W10WEnterp skin and the phases of the Moon, and in other languages the first letter is lowercase.
But now I noticed that in some languages the translation also contains prepositions and these should be lowercase.
So I leave the translation as is.
-
- Posts: 868
- Joined: January 4th, 2018, 9:52 pm
Re: StringCase option Tooltip
Using Lua, the text in the tooltip is displayed like this:jsmorley wrote: ↑January 21st, 2020, 2:57 pm So like this:
Test.lua:Code: Select all
[Rainmeter] Update=1000 DynamicWindowSize=1 AccurateText=1 [Variables] [Lua] Measure=Script ScriptFile=#CURRENTPATH#Test.lua Disabled=1 [MeasureString] Measure=String String=hello world [MeterString] Meter=String MeasureName=MeasureString FontSize=15 FontWeight=400 FontColor=255,255,255,255 SolidColor=47,47,47,255 Padding=5,5,5,5 AntiAlias=1 StringCase=Upper DynamicVariables=1 ToolTipText=[&Lua:ProperCase('[&MeasureString]')]
Code: Select all
function ProperCase(inArg) return (inArg:gsub('(%S)(%S*)', function(first, rest) return first:upper() .. rest:lower() end)) end
1.png
When using global substitute gsub(), the character class %S in Lua pattern matching simply means "not a space or tab".
11:00 Pm Thu
Is it possible that am and pm to be lowercase?
11:00 pm Thu
-
- Rainmeter Sage
- Posts: 16183
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: StringCase option Tooltip
No. It is displayed as Hello World. Isn't it?
-
- Rainmeter Sage
- Posts: 16183
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: StringCase option Tooltip
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]
-
- Rainmeter Sage
- Posts: 7179
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: StringCase option Tooltip
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...
That being said, if the talk is about weather skins, the good thing about weather data is that the number of strings retrieved are limited - meaning you don't have to deal with every word in the dictionary, just a few dozens of them (at most). Having said that, displaying weather data in all/multiple languages complicates things.
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...
That being said, if the talk is about weather skins, the good thing about weather data is that the number of strings retrieved are limited - meaning you don't have to deal with every word in the dictionary, just a few dozens of them (at most). Having said that, displaying weather data in all/multiple languages complicates things.
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...
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA