Regional settings? Using . vs , as decimal place?

95 views
Skip to first unread message

Sam Schloegel

unread,
Jul 2, 2020, 11:03:45 AM7/2/20
to QLab
Hi,

How does QLab determine whether to use a . or , as the decimal point in a float argument of an OSC message? How is the regional variability determined and can it be manually forced to do one or the other?

Just curious,
Sam

Sam Kusnetz

unread,
Jul 2, 2020, 11:28:28 AM7/2/20
to ql...@googlegroups.com
On Jul 2, 2020, 11:03 AM -0400, Sam Schloegel <sam.sc...@gmail.com>, wrote:

How does QLab determine whether to use a . or , as the decimal point in a float argument of an OSC message? How is the regional variability determined and can it be manually forced to do one or the other?

Hello fellow Sam

Localization is a sticky subject so QLab has actually gotten this wrong a few times. Thanks to some patient eastern European QLab users, though, we have arrived at the following consistent behavior:

In all versions of QLab 3 and 4 the following is true of outgoing OSC messages:
  • Any numeric arguments to OSC messages that are NOT enclosed in quotes are converted to decimal numbers (floats) using the locale set in System Preferences.
  • Any arguments that ARE enclosed in quotes are regarded as strings.
In QLab 4.6.4 and later, the results of OSC queries also filter through the Mac’s locale settings. Previously they did not, which resulted in errors when using OSC queries that involved decimal values on a Mac using a locale that uses commas for decimal separators.

There is no way to override this behavior on a cue by cue basis, but System Preferences gives you the option to manually set the decimal separator by going to System Preferences > Language & Region > Advanced… > General.

Unfortunately, there is no way to set the decimal separator for QLab separately from the general setting on the Mac.

Best
Sam

––
Sam Kusnetz [he/him/his] (what is this?)
Figure 53
https://qlab.app | https://figure53.com
Message has been deleted

micpool

unread,
Jul 4, 2020, 7:34:47 PM7/4/20
to QLab
Sorry small error in previous post (deleted)


Further to Sam's post, this problem can also crop up with AppleScripts written for QLab, including some in the QLab Cookbook.

This is particularly the case where notes fields or other text values of cues are used to hold variables. e.g

tell application id "com.figure53.QLab.4" to tell front workspace
set the notes of cue "1" to 29.4
set the pre wait of cue "1" to notes of cue "1" as integer
end tell

In a comma decimal separator localisation you cannot change or coerce  "29.4" into a number.

This script will allow easy testing of which decimal localisation is in use.

--decimal separator detector
try
set thenumber to "29.4"
set thenumber to thenumber as integer
on error
display dialog "Your system is set to use comma as the decimal separator"
end try
try
set thenumber to "29,4"
set thenumber to thenumber as integer
on error
display dialog "Your system is set to use period as the decimal separator"
end try

If you need to change decimals to commas in an applescript then  something along these lines will do that.

--change to commas for comma decimal localisations for a variable thePeriodSeparatedDecimalValue

set currentTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set the item_list to every text item of thePeriodSeparatedDecimalValue
set AppleScript's text item delimiters to the ","
set thePeriodSeparatedDecimalValue to the item_list as string
set AppleScript's text item delimiters to currentTIDs

MIc
Message has been deleted

micpool

unread,
Jul 7, 2020, 9:20:41 AM7/7/20
to QLab
Here is a handy  applet,  for non technical users to run, to  be able to tell you their decimal separator settings without them having to delve into  the Language and Region system preferences.


Mic
Reply all
Reply to author
Forward
0 new messages