[android] Add setting for change map language #8237
No reviewers
Labels
No labels
Accessibility
Accessibility
Address
Address
Android
Android
Android Auto
Android Auto
Android Automotive (AAOS)
Android Automotive (AAOS)
API
API
AppGallery
AppGallery
AppStore
AppStore
Battery and Performance
Battery and Performance
Blocker
Blocker
Bookmarks and Tracks
Bookmarks and Tracks
Borders
Borders
Bug
Bug
Build
Build
CarPlay
CarPlay
Classificator
Classificator
Community
Community
Core
Core
CrashReports
CrashReports
Cycling
Cycling
Desktop
Desktop
DevEx
DevEx
DevOps
DevOps
dev_sandbox
dev_sandbox
Directions
Directions
Documentation
Documentation
Downloader
Downloader
Drape
Drape
Driving
Driving
Duplicate
Duplicate
Editor
Editor
Elevation
Elevation
Enhancement
Enhancement
Epic
Epic
External Map Datasets
External Map Datasets
F-Droid
F-Droid
Fonts
Fonts
Frequently User Reported
Frequently User Reported
Fund
Fund
Generator
Generator
Good first issue
Good first issue
Google Play
Google Play
GPS
GPS
GSoC
GSoC
iCloud
iCloud
Icons
Icons
iOS
iOS
Legal
Legal
Linux Desktop
Linux Desktop
Linux packaging
Linux packaging
Linux Phone
Linux Phone
Mac OS
Mac OS
Map Data
Map Data
Metro
Metro
Navigation
Navigation
Need Feedback
Need Feedback
Night Mode
Night Mode
NLnet 2024-06-281
NLnet 2024-06-281
No Feature Parity
No Feature Parity
Opening Hours
Opening Hours
Outdoors
Outdoors
POI Info
POI Info
Privacy
Privacy
Public Transport
Public Transport
Raw Idea
Raw Idea
Refactoring
Refactoring
Regional
Regional
Regression
Regression
Releases
Releases
RoboTest
RoboTest
Route Planning
Route Planning
Routing
Routing
Ruler
Ruler
Search
Search
Security
Security
Styles
Styles
Tests
Tests
Track Recording
Track Recording
Translations
Translations
TTS
TTS
UI
UI
UX
UX
Walk Navigation
Walk Navigation
Watches
Watches
Web
Web
Wikipedia
Wikipedia
Windows
Windows
Won't fix
Won't fix
World Map
World Map
No milestone
No project
No assignees
2 participants
Due date
No due date set.
Dependencies
No dependencies set.
Reference: organicmaps/organicmaps-tmp#8237
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "map_lang_v2"
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?
This solution is equivalent to organicmaps/organicmaps#8187.
But now we use global namespace languages for get map locale instead of contex using.
@ -53,6 +53,7 @@ ReadManager::ReadManager(ref_ptr<ThreadsCommutator> commutator, MapDataProvider
, m_counter(0)
Why is it "en" instead of a system-defined one?
@ -53,6 +53,7 @@ ReadManager::ReadManager(ref_ptr<ThreadsCommutator> commutator, MapDataProvider
, m_counter(0)
as a default international language.
but you are right. the best way - using languages::GetCurrentNorm() for initialization.
i updated main PR.
Does it make sense to call Save inside Set and only have Set call here for simplicity?
MapLocale term was not used before in the code, it's better to avoid introducing it.
I've get lost a bit. Why is the drape implementation present in the alternative implementation? Can we avoid passing any messages in Drape at all?
This is not our code style.
JNI code can directly call settings::Set, why is this wrapper needed?
Is this wrapper really needed?
No need in extra line.
Merge two into one?
This retrieves a system locale language code. What happens if it doesn't match the supported language in the coding/string_utf8_multilang.cpp ?
Our main pattern in OM is simplicity, fewer lines of code doing the same are preferred over more lines of code. It's easier to read, debug, modify. Less chance of making a mistake.
Applying patterns blindly everywhere may not be the best strategy.
the term "locale" also appears in the code(see search/processor.cpp). but "Language Code" is more common.
i'll rename it.
i'll rename it.
Isn't that different? Search engine accepts system locale (the language of the system). While we're talking about a list of languages supported in the osm data.
I added a handler for this situation
fixed
see comment uppier
fixed
fixed
⬆️
Are these changes necessary? Is it an accidental indentation change?
Can this call be moved into the framework's call?
@ -101,3 +112,4 @@
updateMapLanguageCodeSummary();
}
@Override
Empty line?
Two empty lines?
@ -40,6 +40,7 @@
<string name="pref_power_management" translatable="false">PowerManagment</string>
This should be properly translated later, when everything else is fixed.
Please double-check that you follow our style guide. It is described in docs folder.
@ -94,0 +104,4 @@
[](StringUtf8Multilang::Lang const & lang) { return lang.m_code != StringUtf8Multilang::kReservedLang; });
return langs;
}();
Why?
Is this whole drape code/message really needed? I don't see that
m_mapLanguageCode
is used anywhere.There should be a way to initiate map redrawing in the framework, @vng right?
⬆️
This PR may also help with debugging on the desktop. @Ferenc- maybe you or some other Linux/Mac contributor can add a setting?
Here the drape code changes should be removed and replaced with
Framework::InvalidateRect
(you may try to passmercator::Bounds::FullRect
)Can any drape modification be avoided?
Thanks!
@kirylkaveryn would it be hard to add the same setting on iOS and test it?
Is it duplicated in several places?
Good that you found an easy way )
✅ Pixel 6 - Android 14
Can this check be moved into
nativeGetSupportedLanguages(bool returnServiceLanguages)
?Thanks a lot for your efforts! We're almost there. A few comments after testing/reviewing.
Should it be removed?
Where is it used?
Should it be removed?
Otherwise it reads as "return only service languages".
Can these variables be made static const, global (above the function), and initialized by lambdas?
Make it more consistent?
This code is called way too often. Looks like a part of Drape should be reused to request the actual setting only when necessary, in
ReadManager::Restart
, and then pass the value via the EngineContext, similarly, as you did it before.Can it be simplified so that
int8_t
is stored in the settings instead ofstd::string
, and then it should be enough to:This change should be removed.
Remove indentation below by negating the if:
@ -94,0 +107,4 @@
static const StringUtf8Multilang::Languages languagesWithoutService = []()
{
StringUtf8Multilang::Languages langs;
nit:
different formatting between
languagesWithoutService
(opening bracket on next line) andallLanguages
(op bracket on the same line)prob a drape re-init will be required then (e.g. similar to gl/vk change)?
which is probably ok as map lang won't be changed often
Please, check my comments, rebase and make 2 commits:
nit: includeServiceLangs
nit: includeServiceLangs
mListener
@ -39,0 +42,4 @@
if (existingLanguages.contains(lang.code))
continue;
languages.add(lang);
Possible returned nil is ok here?
@ -45,1 +52,4 @@
public void setListener(Listener listener)
{
this.mListener = listener;
Why it is better than previous?
nit: includeServiceLangs
nit: includeServiceLangs
void SetMapLangIndex(int8_t mapLangIndex);
void SetMapLangIndex(int8_t mapLangIndex);
SetMapLangIndexMessage(int8_t mapLangIndex)
SetMapLangIndex(int8_t mapLangIndex)
void SetMapLangIndex(int8_t mapLangIndex);