Add international number format setting#94
Open
bitcoin3us wants to merge 2 commits intoMicroPythonOS:mainfrom
Open
Add international number format setting#94bitcoin3us wants to merge 2 commits intoMicroPythonOS:mainfrom
bitcoin3us wants to merge 2 commits intoMicroPythonOS:mainfrom
Conversation
The WebServer import chain (mpos/__init__.py → webserver.py → webrepl_http.py) requires the _webrepl C module which is only available on ESP32 builds. This causes an ImportError on desktop/Unix systems, preventing the entire mpos package from loading. Wrap the import in try/except so desktop builds can still run. main.py already has a similar guard around WebServer.auto_start(). Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add a system-wide number format preference to the Settings app, allowing users to choose their preferred decimal and thousands separators. Follows the TimeZone pattern with a NumberFormat utility class that any app can import. Available formats: - 1,234.56 (US/UK) - 1.234,56 (Europe) - 1 234,56 (French) - 1'234.56 (Swiss) - 1_234.56 (Tech) - 1234.56 / 1234,56 (No thousands separator) New files: - lib/mpos/number_format.py — NumberFormat class with format_number() - tests/test_number_format.py — 14 unit tests Co-Authored-By: Claude Opus 4.6 <[email protected]>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NumberFormatutility class (follows theTimeZonepattern) that any app can import viafrom mpos import NumberFormatNumberFormat.format_number(value, decimals)formats ints and floats using the user's preferred localeAvailable formats
Usage by apps
Test plan
tests/unittest.sh tests/test_number_format.py— all 14 tests pass🤖 Generated with Claude Code