Skip to content

Commit d18322a

Browse files
committed
Document - GUI dvelopment - added Localization of float numbers
1 parent 259ad89 commit d18322a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/src/gui/gui-dev-reference.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ It is already used and integrated into linuxcnc's system requirements. +
2525
While C or C\++ could be used, it severely limits who can maintain and develop them. +
2626
It would be better to extend python with C/C++ modules for whatever function that requires it.
2727

28+
== Localization of float numbers in GUIs
29+
Different locales use different decimal separators and thousands separators. Locale-specific
30+
string-to-float functions should be avoided as they may give unexpected results.
31+
(For example the text string "1.58" in de_DE will be converted to 158 by atof()).
32+
The following guidelines (based on avoiding ambiguity rather than on "correctness" in any specific locale)
33+
are suggested if parsing float to string and vice-versa:
34+
35+
* In the case of input allow either comma (,) or point(.) as a decimal separator, but reject any input that has more than one of either. Space should be accepted but not required as a thousands separator.
36+
* In the case of display either use point (.) consistently or use the current localisation format consistently. The emphasis here being on "consistently".
37+
2838
== Basic Configuration
2939
Currently, most screens use a combination of INI file and preference file entries to configure their functions. +
3040
INi text files are usually used for the common machine controller settings, while text based preference files

0 commit comments

Comments
 (0)