User Preferences: Numbers string 3/4 digit grouping #116710

Open
YimingWu wants to merge 1 commits from ChengduLittleA/blender:numbers-grouping into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

Added the functionality for switching 3/4 digit grouping for different conventions.

A lot of eastern cultures like Chinese uses 4 digit grouping for numbers such as 1234,5678.
This change allows user more choice for readability.

BLI_str_format_int_grouped is renamed BLI_str_format_int_grouped_n and a default
value of 3 is given by the marco BLI_str_format_int_grouped to maintain the behavior of
old code.

Currently it only has 3 or 4 digit grouping, I believe there can be more formatting
styles available.

Currently affecting viewport and status bar numbers. The option is available in
User Preference > Interface > Editors section.

图片

图片

Added the functionality for switching 3/4 digit grouping for different conventions. A lot of eastern cultures like Chinese uses 4 digit grouping for numbers such as `1234,5678`. This change allows user more choice for readability. `BLI_str_format_int_grouped` is renamed `BLI_str_format_int_grouped_n` and a default value of 3 is given by the marco `BLI_str_format_int_grouped` to maintain the behavior of old code. Currently it only has 3 or 4 digit grouping, I believe there can be more formatting styles available. Currently affecting viewport and status bar numbers. The option is available in `User Preference > Interface > Editors` section. ![图片](/attachments/622a40ca-191f-4b84-afc7-99e6a67824d9) ![图片](/attachments/3a455771-b36a-4135-86dc-fdd92164c968)
YimingWu added the
Interest
Translations
Interest
User Interface
labels 2024-01-02 14:39:01 +01:00
Iliya Katushenock added this to the User Interface project 2024-01-02 15:17:41 +01:00
Iliya Katushenock removed the
Interest
Translations
label 2024-01-02 15:17:48 +01:00
Author
Member

Also see D6179, ICU might be doable, but personally I think it's too heavy of an add for general processing of this format that's not used that frequently

Also see [D6179](https://archive.blender.org/developer/D6179), [ICU](https://en.wikipedia.org/wiki/International_Components_for_Unicode) might be doable, but personally I think it's too heavy of an add for general processing of this format that's not used that frequently
YimingWu force-pushed numbers-grouping from 986bbd89ad to ebbb3d242c 2024-01-03 08:46:16 +01:00 Compare

Typically, this kind of thing is handled by following the locale rather than every application configuring it separately.

Would it make sense to use these when Chinese language is used, rather than having a dedicated option?

If there is a need for an option, it feels more logical to have it next to other translation settings.

Typically, this kind of thing is handled by following the locale rather than every application configuring it separately. Would it make sense to use these when Chinese language is used, rather than having a dedicated option? If there is a need for an option, it feels more logical to have it next to other translation settings.
Author
Member

I'd prefer for it to go with translation setting too. So I might be to setting this value in the language set callback. The language enumeration doesn't seem to hold more data. I couldn't seem to find if there there is any "table" for language-associated configurations @Harley ? Looks like all it's relevant is the text file datafiles/locale/languages. Adding extra config in there seems ugly. Any existing ways we can link extra information with each local? (Otherwise I'll just manually add a table somewhere to look up)

I'd prefer for it to go with translation setting too. So I might be to setting this value in the language set callback. The language enumeration doesn't seem to hold more data. I couldn't seem to find if there there is any "table" for language-associated configurations @Harley ? Looks like all it's relevant is the text file `datafiles/locale/languages`. Adding extra config in there seems ugly. Any existing ways we can link extra information with each local? (Otherwise I'll just manually add a table somewhere to look up)

I don't know how well it will work for us, but I think this is what the locale in the C++ standard library or fmtlib is for. That is Blender would not have its own table specifying the formatting for each language, but rather get that information from or do the formatting through those APIs.

I don't know how well it will work for us, but I think this is what the locale in the C++ standard library or [fmtlib](https://fmt.dev/latest/api.html?highlight=locale#locale) is for. That is Blender would not have its own table specifying the formatting for each language, but rather get that information from or do the formatting through those APIs.
Member

My struggle here is the conflation of locale and language. There might be a default language as part of a locale, but I don't want to infer locale from language.

For example, I am in Canada so I have my own computer set to show time in 12 hour format. Changing my language in the computer, or in Blender, to French does not mean I want to change the time format to 24 hour. Similarly for the use of period or comma as decimal separator. This varies by region, and those regions may have predominant language, but this isn't tied to the language. So people in France prefer "12.000,00", regardless of language.

You might prefer four-digit large number grouping, but I'd imagine that is what you want regardless of what language selected in Blender. This is something you set in the OS once outside of Blender and we should be honoring that setting.

Yes, there are some formatting differences that are per-language but this one is per region. Just like people in India will want their large number group formatting which is like 10,00,00,000. This shouldn't change if they show Blender in English or Chinese.

As mentioned by Brecht this would most likely involve using a standard library for the formatting of these things, rather than rolling our own, but using the current locale not the one taken from the blender output language setting.

My struggle here is the conflation of locale and language. There might be a default language as part of a locale, but I don't want to infer locale from language. For example, I am in Canada so I have my own computer set to show time in 12 hour format. Changing my language in the computer, or in Blender, to French does not mean I want to change the time format to 24 hour. Similarly for the use of period or comma as decimal separator. This varies by region, and those regions may have predominant language, but this isn't tied to the language. So people in France prefer "12.000,00", regardless of language. You might prefer four-digit large number grouping, but I'd imagine that is what you want regardless of what language selected in Blender. This is something you set in the OS once outside of Blender and we should be honoring that setting. Yes, there are some formatting differences that are per-language but this one is per region. Just like people in India will want their large number group formatting which is like 10,00,00,000. This shouldn't change if they show Blender in English or Chinese. As mentioned by Brecht this would most likely involve using a standard library for the formatting of these things, rather than rolling our own, but using the current locale not the one taken from the blender output language setting.

It indeed doesn't necessarily have to depend on the chosen translation. Maybe it's rather a checkbox to use system settings for formatting numbers and dates.

It indeed doesn't necessarily have to depend on the chosen translation. Maybe it's rather a checkbox to use system settings for formatting numbers and dates.
Author
Member

There's also a problem with system-wise formatting like in this specific case of thousand/10-thousand marker. Our systems are generally just 3-digit group anyway, the local settings do affect some stuff like use period or comma. I just tested on my machine where no matter you are using LC_ALL=zh_CN or en_US or hi_IN, printf "%'.3f\n" 123123142153415142 will give you 123,123,142,153,415,142.000.

Will test ICU and see if there's any difference, likely not. Since this is kind of a minor thing, people kinda get used to it, but it still feel weird in our languages.

There's also a problem with system-wise formatting like in this specific case of thousand/10-thousand marker. Our systems are generally just 3-digit group anyway, the local settings do affect some stuff like use period or comma. I just tested on my machine where no matter you are using `LC_ALL=zh_CN` or `en_US` or `hi_IN`, `printf "%'.3f\n" 123123142153415142` will give you `123,123,142,153,415,142.000`. Will test ICU and see if there's any difference, likely not. Since this is kind of a minor thing, people kinda get used to it, but it still feel weird in our languages.
Member

@ChengduLittleA

Note that if we go down this path, one thing we can't get for any foreseeable future is display of numbers in inputs with comma decimal delimiter, as in "1.00,99". There are quite a few reasons, mostly related to our integration with python, but also for portability of scripts. There might be some solution for this, but you should probably assume we can't do this. That might result in some uncanny valley here if some numbers are regionally formatted.

@ChengduLittleA Note that if we go down this path, one thing we can't get for any foreseeable future is display of numbers in inputs with comma decimal delimiter, as in "1.00,99". There are quite a few reasons, mostly related to our integration with python, but also for portability of scripts. There might be some solution for this, but you should probably assume we can't do this. That might result in some uncanny valley here if some numbers are regionally formatted.
Merge conflict checking is in progress. Try again in few moments.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u numbers-grouping:ChengduLittleA-numbers-grouping
git checkout ChengduLittleA-numbers-grouping
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#116710
No description provided.