comaps/comaps
42
1.9k
Fork
You've already forked comaps
161

[android] Ensure correct system language order in map lang selection #2685

Merged
x7z4w merged 2 commits from gekeleda/comaps:android/fix_system_lang_order into main 2025年11月25日 10:27:12 +01:00

Small fix for #2463 that makes sure the system languages are not only at the top, but also actually in the correct order.

Apparently during my testing for the initial PR they just happened to be ordered correctly by chance.

Signed-off-by: gekeleda git@davidgekeler.eu

Small fix for #2463 that makes sure the system languages are not only at the top, but also actually in the correct order. Apparently during my testing for the initial PR they just happened to be ordered correctly by chance. Signed-off-by: gekeleda <git@davidgekeler.eu>
[android] Ensure correct system language order
All checks were successful
DCO / check (pull_request) Successful in 2s
02c7f24fdb
Signed-off-by: gekeleda <git@davidgekeler.eu>
jeanbaptisteC 2025年11月24日 06:47:20 +01:00
x7z4w left a comment
Copy link

Logically a simple add does the same thing, why it doesn't work right now?

Logically a simple `add` does the same thing, why it doesn't work right now?
@ -50,3 +53,3 @@
Localelocale=systemLocales.get(i);
if(locale!=null&&locale.getLanguage().equals(lang.code))
systemLanguages.add(lang);
systemLanguages.set(i,lang);
Owner
Copy link

What happens if i is at the same position in multiple iterations for lang?

What happens if `i` is at the same position in multiple iterations for `lang`?
Author
Member
Copy link

That can happen only if the codes of two separate languages from the nativeSupportedLanguages List were equal to the same systemLocale, since every i corresponds exactly to one systemLocale. Currently that should not be possible, as both our native language code as well as Android give us two-letter language codes here.

I still added a small fix, just in case this behaviour changes in the future. With the fix, no languages should be lost in any case.

That can happen only if the codes of two separate languages from the `nativeSupportedLanguages` List were equal to the same `systemLocale`, since every `i` corresponds exactly to one `systemLocale`. Currently that should not be possible, as both our native language code as well as Android give us two-letter language codes here. I still added a small fix, just in case this behaviour changes in the future. With the fix, no languages should be lost in any case.
x7z4w marked this conversation as resolved
Author
Member
Copy link

The issue was that previously, with the simple add, the order of languages in systemLanguages would be decided by the order they appear in Editor.nativeGetSupportedLanguages(false) (due to the iteration over that in the outer loop). But what we want is the order in systemLocales, which is the order the user sets in Android settings

The issue was that previously, with the simple `add`, the order of languages in `systemLanguages` would be decided by the order they appear in `Editor.nativeGetSupportedLanguages(false)` (due to the iteration over that in the outer loop). But what we want is the order in `systemLocales`, which is the order the user sets in Android settings
[android] Enable more robust language matching
Some checks failed
Android Check Store Metadata / Check app metadata (pull_request) Successful in 6s
DCO / check (pull_request) Successful in 2s
iOS Check metadata / Check app metadata (pull_request) Successful in 4s
Cleanup caches by a branch / cleanup (pull_request) Failing after 2s
eac8f5fde3
Signed-off-by: gekeleda <git@davidgekeler.eu>
Sign in to join this conversation.
No reviewers
comaps/Android
Labels
Clear labels
accessibility
Visual contrast, screen readers, etc.
addresses
Related to addresses, post codes, city/town/village borders
AI-assisted
AI-assisted PRs or issues
Android
Android app
Android Auto
Android Auto integration
Android Automotive
Android Automotive app
api
Deeplinks and URLs handled by the API
app stores
Google Play, App Store, F-Droid, Obtanium, Huawei Gallery, Acressent, Flathub, IzzyOnDroid, etc.
battery & performance
Performance and battery consumption-related problems and optimisations
borders
Related to borders between countries / regions
bug
Something is not working
build
building of apps
CarPlay
CarPlay integration
community
Community relations
contribution welcome
Contributions are very welcome, get started here
core
C++ core of the app
crash
Crash reporting
cycling
Specific to using a bicycle or similar vehicles
desktop
Qt desktop app incl. designer
devops
directions
Voice and visual turn-by-turn directions
docs
Documentation
downloader
Map downloader
drape
The C++ map rendering engine
driving
Specific to driving a car or similar vehicles
duplicate
This issue or pull request already exists
editor
Built-in OSM editor
elevation
Contour lines, elevation profiles, ...
enhancement
New feature
EPIC
A big idea or a piece of work that requires a lot of effort to implement
F-Droid
F-Droid platform
favorites
Places and GPS tracks
feature parity
A feature is implemented on one platform, but not on another
fonts
Fonts
good first issue
Interested in contributing? Get started here
help wanted
Need some help
icons
Map features icons
invalid
Something is wrong
iOS
iOS app
legal
Legal aspects
linux phone
LibreM, PinePhone and other mobile linuxes
location
Via GPS, network, etc.
macOS
Emulated iOS App or Qt Desktop App specifically related to macOS
map data
Related to OpenStreetMap data
mapgen needed
map generation is needed for PR to take full effect
maps compat
compatibility of newer maps with older apps; issues and PRs breaking or fixing compatibility
maps generator
Maps generator
navigation
The navigation turn-by-turn app mode
need feedback
Further information is requested
needs design
not planned
This is not planned at the moment
OM
Related to or references Organic Maps
opening hours
Related to Business Hours, off time, holidays, seasonal
outdoor
Hiking, backcountry cycling, 4WD, etc.
POI info
Various feature attributes usually displayed on the place page
priority
High
Seriously affects a lot of users or breaks the app severely
priority
Low
Not urgent or only happens in rare cases
priority
Medium
Happens enough to be a concern, but not app-breaking
privacy
Privacy aspects
public feedback needed
Experimental changes which requite explicit public feedback before continuing with them
public transport
Specific to public transport (busses, trams, subways, trains etc.)
question
Questions and Discussions
raw idea
Needs more discussion or to be further elaborated
refactoring
Improving the structure or simplifying the code, improving maintainability
regional
Different depending on the country or region
regression
Regression in the app
releases
Release management
route planning
Preview and plan your route
routing
Routing engine
search
Search inside of the app
security
Security improvements
source data
Related to OSM, SRTM, Tiger etc.
styles
Map styling, incl. mapping OSM tags
subway
The special subway layer
task
Internal things that have a clear way for implementation
tests
Unit tests
track recording
Track recording
traffic
Traffic information (still under development)
translations
Translations and all other kinds of localisation
TTS
Text-to-Speech
UI
User interface
UX
User experience
wait for upstream
Waiting for something to be done upstream
walking
Specific to walking
Wikipedia
Related to the embedded Wikipedia articles
Windows
Windows related
world map
The world overview map
No labels
accessibility
addresses
AI-assisted
Android
Android Auto
Android Automotive
api
app stores
battery & performance
borders
bug
build
CarPlay
community
contribution welcome
core
crash
cycling
desktop
devops
directions
docs
downloader
drape
driving
duplicate
editor
elevation
enhancement
EPIC
F-Droid
favorites
feature parity
fonts
good first issue
help wanted
icons
invalid
iOS
legal
linux phone
location
macOS
map data
mapgen needed
maps compat
maps generator
navigation
need feedback
needs design
not planned
OM
opening hours
outdoor
POI info
priority
High
priority
Low
priority
Medium
privacy
public feedback needed
public transport
question
raw idea
refactoring
regional
regression
releases
route planning
routing
search
security
source data
styles
subway
task
tests
track recording
traffic
translations
TTS
UI
UX
wait for upstream
walking
Wikipedia
Windows
world map
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 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
comaps/comaps!2685
Reference in a new issue
comaps/comaps
No description provided.
Delete branch "gekeleda/comaps:android/fix_system_lang_order"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?