Select comma vs period
Select comma vs period
Hi Dave.
I have hopefully a quite easy request. I a working on some voice feedback from my sonos system.
One issue is that when the temperature is spoken it says that temperature is now 5 "period" 4 degrees. In Norwegian this sounds strange. It should have been comma instead.
Is it possible to make a selection on this? Or maybe a new state that converts to "," instead of "."?
thanks for your work on this plugin. It is rock solid and me and my family use this every day.
I have hopefully a quite easy request. I a working on some voice feedback from my sonos system.
One issue is that when the temperature is spoken it says that temperature is now 5 "period" 4 degrees. In Norwegian this sounds strange. It should have been comma instead.
Is it possible to make a selection on this? Or maybe a new state that converts to "," instead of "."?
thanks for your work on this plugin. It is rock solid and me and my family use this every day.
Håvard
Re: Select comma vs period
That would sound strange in every language I'm guessing. Does this behavior relate to all decimal numbers or only selected states? I will add this to the list of things to take a look at for the next update. The plugin should really use local settings for stuff like that.haavarda wrote:Hi Dave.
I have hopefully a quite easy request. I a working on some voice feedback from my sonos system.
One issue is that when the temperature is spoken it says that temperature is now 5 "period" 4 degrees. In Norwegian this sounds strange. It should have been comma instead.
Is it possible to make a selection on this? Or maybe a new state that converts to "," instead of "."?
thanks for your work on this plugin. It is rock solid and me and my family use this every day.
I'm glad you're enjoying the plugin. Hopefully, WU will get the API gremlins under control in the new year.
Dave
I came here to drink milk and kick ass....and I've just finished my milk.
My Plugins and Scripts
My Plugins and Scripts
Re: Select comma vs period
Thanks. At least in Scandinavia comma is the decimal separator. I agree that this should be handled in the WU data...
Sent from my iPhone using Tapatalk
Sent from my iPhone using Tapatalk
Håvard
Re: Select comma vs period
Out of pure interest, not directly related to the question.
How would you pronounce "5,7 degrees" in this instance?
Do you still pronounce it "5 point 7 degrees" like English?
Or "5 comma 7 degrees"?
Sent from my iPhone using Tapatalk
How would you pronounce "5,7 degrees" in this instance?
Do you still pronounce it "5 point 7 degrees" like English?
Or "5 comma 7 degrees"?
Sent from my iPhone using Tapatalk
- jay (support)
- Site Admin
- Posts: 19232
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Select comma vs period
+1howartp wrote:How would you pronounce "5,7 degrees" in this instance?
Though, I guess if it's a non-English language it wouldn't really help much to know...
Re: Select comma vs period
I'm honestly not sure what to do about this. I'm not sure how I'd make a setting to convert the values as they should all be stored as integers or floats. It's certainly possible to add additional states with the decimal converted to a comma, but which ones? What I would suggest is a small Python script that saves the current temperature to a variable (whenever the temperature value changes) and then speak from that. The conversion should be easy (untested):haavarda wrote:Hi Dave.
I have hopefully a quite easy request. I a working on some voice feedback from my sonos system.
One issue is that when the temperature is spoken it says that temperature is now 5 "period" 4 degrees. In Norwegian this sounds strange. It should have been comma instead.
Is it possible to make a selection on this? Or maybe a new state that converts to "," instead of "."?
thanks for your work on this plugin. It is rock solid and me and my family use this every day.
Code: Select all
num = str(indigo.devices[12345678].states['temp']).replace('.', ',')
indigo.variable.updateValue(12345678, num)I came here to drink milk and kick ass....and I've just finished my milk.
My Plugins and Scripts
My Plugins and Scripts
Re: Select comma vs period
http://www.statisticalconsultants.co.nz ... imals.html
The most universal would probably be using locale I suppose. I don't know enough about this to tell whether this would affect other parts of a plugin or Indigo.
The most universal would probably be using locale I suppose. I don't know enough about this to tell whether this would affect other parts of a plugin or Indigo.
Re: Select comma vs period
Thanks krissh.krissh wrote:http://www.statisticalconsultants.co.nz/blog/how-the-world-separates-its-decimals.html
The most universal would probably be using locale I suppose. I don't know enough about this to tell whether this would affect other parts of a plugin or Indigo.
I guess I'm still a bit at sea. I'm storing the value as a float so I would expect that the server's localization settings would handle things that should be adjusted. I could certainly add a setting that could adjust the 'state.ui' value based on locale, but I suspect that most folks won't be keying on that for things like speech (although it would improve users' experience for display on control pages I suppose). I'd rather not add a bunch of new states (the plugin has a huge number already).
In any event, I want to be responsive to the need, I'm just not sure what the best approach is. Maybe adjusting the state.ui value is the best approach.
I came here to drink milk and kick ass....and I've just finished my milk.
My Plugins and Scripts
My Plugins and Scripts
Re: Select comma vs period
Since I'm also in a "comma" country (same as haavarda) I've also experienced some dot/comma issues as the Indigo device states in general have dot/period rather than comma. It hasn't been a problem for me though, since Mac OS speech will pronounce 2.5 as "2 comma 5" when speaking Norwegian.
I was thinking in lines of having a text field in plugins config where users could enter a locale name, "nb_NO" for Norway and so on. And then have one additional state 'state.locale' for example. This would make it possible to have both thousand separators and decmial point correct for all countries. Best would be if this was possible in Indigo server of course. And I think matt or jay may have to comment on feasibility of using locale in a plugin, if this might break other things etc..
Another possibility is maybe to have a function included in a separate plugin with wrapper devices, such as the Adapters plugin for example. It may very well be possible already using the custom formula adapter, although I haven't tried it.
I was thinking in lines of having a text field in plugins config where users could enter a locale name, "nb_NO" for Norway and so on. And then have one additional state 'state.locale' for example. This would make it possible to have both thousand separators and decmial point correct for all countries. Best would be if this was possible in Indigo server of course. And I think matt or jay may have to comment on feasibility of using locale in a plugin, if this might break other things etc..
Another possibility is maybe to have a function included in a separate plugin with wrapper devices, such as the Adapters plugin for example. It may very well be possible already using the custom formula adapter, although I haven't tried it.
Re: Select comma vs period
Thanks for the script Dave. I think this kind of fix will work for me.
Sent from my iPhone using Tapatalk
Sent from my iPhone using Tapatalk
Håvard
Re: Select comma vs period
Actually, the Adapters Plugin sounds like a superior option. I can't easily test this, but after reading the docs, I *believe* that this setup *should* yield the string '37,2'.krissh wrote:Another possibility is maybe to have a function included in a separate plugin with wrapper devices, such as the Adapters plugin for example. It may very well be possible already using the custom formula adapter, although I haven't tried it.
Will need to rely on someone with a proper locale setting to test it out, however.
https://docs.python.org/2/library/strin ... i-language
I came here to drink milk and kick ass....and I've just finished my milk.
My Plugins and Scripts
My Plugins and Scripts
Re: Select comma vs period
I did a quick test, and it returns the decimal number, but with period: 37.2
I'm guessing the locale has to be set within the plugin, but again don't know if this would mess up other things in Indigo or the plugin..
Tried this:
The only thing I can see in os.environ that seems related to locale is this
I'm guessing the locale has to be set within the plugin, but again don't know if this would mess up other things in Indigo or the plugin..
Tried this:
Code: Select all
>>> import locale
>>> locale.getdefaultlocale()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 511, in getdefaultlocale
return _parse_localename(localename)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 443, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
>>> locale.getlocale()
(None, None)
Code: Select all
'LC_CTYPE': 'UTF-8'Re: Select comma vs period
I have the same problem with dot instead of comma in the Weatherflow plugin.
Did you find any solution with the dot, comma problem?
Skickat från min iPad med Tapatalk
Did you find any solution with the dot, comma problem?
Skickat från min iPad med Tapatalk
