[android]Enable per-app language #3584

Merged
root merged 3 commits from github/fork/Jean-BaptisteC/language into master 2022-11-24 20:59:14 +00:00
Member

This PR add ability to change app language only for OM on devices on Android 13.
More information here

  • List of languages is picked from directory values-{languages} in res directory.
  • To check if that works, used devices on Android 13 -> go to OM Android settings or language settings.

This PR cannot be merge because bump appcompat to 1.6.0 need update app theme -> check this #3537 (comment)

This PR add ability to change app language only for OM on devices on Android 13. More information [here](https://developer.android.com/guide/topics/resources/app-languages) - List of languages is picked from directory values-{languages} in res directory. - To check if that works, used devices on Android 13 -> go to OM Android settings or language settings. This PR cannot be merge because bump appcompat to 1.6.0 need update app theme -> check this https://git.omaps.dev/organicmaps/organicmaps/issues/3537#issuecomment-1275106065
Author
Member

When i changed language in Android settings and i back to OM, app language have changed. But to update maps language we need to restart app. @biodranik Is it ok for you, i'm not sure user change language every day and restart app to update map is not big inconvenient.

When i changed language in Android settings and i back to OM, app language have changed. But to update maps language we need to restart app. `@biodranik` Is it ok for you, i'm not sure user change language every day and restart app to update map is not big inconvenient.
Owner
https://git.omaps.dev/organicmaps/organicmaps/pulls/3586
biodranik commented 2022-10-12 08:53:53 +00:00 (Migrated from github.com)

It is ok, maybe we can show some kind of hint about that? Or at least add it into the FAQ.

It is ok, maybe we can show some kind of hint about that? Or at least add it into the FAQ.
biodranik commented 2022-10-12 16:06:54 +00:00 (Migrated from github.com)

What about adding this?
image

What about adding this? <img width="904" alt="image" src="/uploads/69a3f09c7e1c2ad02c91c012a6808c5e/195393316-dcd621af-640f-4b5c-b770-c479003ef735.png">
biodranik commented 2022-10-12 16:07:33 +00:00 (Migrated from github.com)

Are you sure about en-rGB? Should it be en-GB, as in the example?

Are you sure about en-rGB? Should it be en-GB, as in the example?
biodranik commented 2022-10-12 16:08:10 +00:00 (Migrated from github.com)

Are you sure about these? In the example they use zh-Hant and zh-Hans. Can you please test if it works properly?

Are you sure about these? In the example they use zh-Hant and zh-Hans. Can you please test if it works properly?
biodranik commented 2022-10-12 16:08:15 +00:00 (Migrated from github.com)

ditto

ditto
biodranik commented 2022-10-12 16:08:21 +00:00 (Migrated from github.com)

ditto

ditto
biodranik commented 2022-10-12 16:08:27 +00:00 (Migrated from github.com)

ditto

ditto
Author
Member

Check this

Check [this ](https://developer.android.com/guide/topics/resources/localization#avoid-creating-more-resource-files-and-text-strings-than-you-need)
Author
Member

What about adding this? image

I think the real interest is to reduce size of app by remove unused strings in libraries.

Edit:

  • I have add resConfigs in build.gradle in other branch. APK have lost 600Ko ~ in size.
  • Do you want i implement this configuration ?
> What about adding this? <img alt="image" width="904" src="/uploads/ec815273df31b8a526676104238e0505/195393316-dcd621af-640f-4b5c-b770-c479003ef735.png"> I think the real interest is to reduce size of app by remove unused strings in libraries. Edit: - I have add resConfigs in build.gradle in other branch. APK have lost 600Ko ~ in size. - Do you want i implement this configuration ?
Author
Member

It is ok, maybe we can show some kind of hint about that? Or at least add it into the FAQ.

  • I not sure, it's necessary to add something in FAQ (I have discover FAQ in app today :) ) because this feature is only available on devices used Android 13.

  • About map languages not synchronised when you changes language, maybe you can implement this with #391

> It is ok, maybe we can show some kind of hint about that? Or at least add it into the FAQ. - I not sure, it's necessary to add something in FAQ (I have discover FAQ in app today :) ) because this feature is only available on devices used Android 13. - About map languages not synchronised when you changes language, maybe you can implement this with https://git.omaps.dev/organicmaps/organicmaps/issues/391
biodranik commented 2022-10-12 20:13:12 +00:00 (Migrated from github.com)

Did you test these languages on your device? Did they work?

Did you test these languages on your device? Did they work?
Author
Member

I have test with english

  • en_US (default english)

-en_GB

I have test with english - en_US (default english) <img src="/uploads/89e54b43af28d87c2e14b9296c00e8f5/195440640-b73e999b-9cf3-4e49-985e-7714a43fc1fc.png" height="500"/> -en_GB <img src="/uploads/a2911b486c6af1158ef38526af0b94d6/195440840-e60d1b96-f4cc-49f7-a532-25a7b80b6bf1.png" height="500" />
biodranik commented 2022-10-12 20:54:05 +00:00 (Migrated from github.com)

What about Chinese?

What about Chinese?
Author
Member

Examples:

  • pt
    delete (bottomsheet on map)=Eliminar

  • pt_BR(Brazil)
    delete=Apagar

Examples: - pt delete (bottomsheet on map)=Eliminar - pt_BR(Brazil) delete=Apagar
Author
Member

Examples:

  • fr (France)
    Translittération en latin (App settings)

  • fr_CA (Canada)
    Translittération vers l'alphabet latin (App settings)

Examples: - fr (France) Translittération en latin (App settings) - fr_CA (Canada) Translittération vers l\'alphabet latin (App settings)
Author
Member

Examples:

es (Spain)
Transliteración al latín (App settings)

es_MX (Mexico)
Transliteración al alfabeto latino (App settings)
Examples: es (Spain) Transliteración al latín (App settings) es_MX (Mexico) Transliteración al alfabeto latino (App settings)
Owner

nit: new line

nit: new line
Owner

Are you sure here? I can see the following names in res/values:

  • values-zh-rHK
  • values-zh-rMO
  • values-zh-rTW
Are you sure here? I can see the following names in res/values: - values-zh-rHK - values-zh-rMO - values-zh-rTW
Author
Member

zh-Hans

zh-Hant

zh-Hans <img src="/uploads/7416cd533721855b9ab2614f25264014/195567788-6a039942-ab40-4cce-8516-395936283998.png" height="500"/> zh-Hant <img src="/uploads/cff09d7718d06769a67ecb85f43a4e65/195567911-36f497fb-1805-4ba7-9e57-2424da542700.png" height="500"/>
Author
Member

add zh-HK or zh-rHK have none difference, because string name file contains r is just use tu specifie when you have some strings only for country.
Examples:
If i want translate all strings for Great Britain, i create res file with this name values-en-GB
If i want only translate special strings for Great Britain, i create res file with this name values-en-rGB. (And strings not translate in this file are take from values-en or values.

I have test with r and without, 0 difference.

https://developer.android.com/guide/topics/resources/localization#avoid-creating-more-resource-files-and-text-strings-than-you-need

add zh-HK or zh-rHK have none difference, because string name file contains `r` is just use tu specifie when you have some strings only for country. Examples: If i want translate all strings for Great Britain, i create res file with this name values-en-GB If i want only translate special strings for Great Britain, i create res file with this name values-en-rGB. (And strings not translate in this file are take from values-en or values. I have test with `r` and without, 0 difference. https://developer.android.com/guide/topics/resources/localization#avoid-creating-more-resource-files-and-text-strings-than-you-need
biodranik commented 2022-10-13 12:53:50 +00:00 (Migrated from github.com)
</locale-config>

```suggestion:-0+0 </locale-config> ```
biodranik commented 2022-10-13 12:54:14 +00:00 (Migrated from github.com)

approved this merge request

approved this merge request
biodranik commented 2022-10-13 12:55:03 +00:00 (Migrated from github.com)

I've read the docs and confirm that the new locale format should work. We use the old one, pre-Android 7 for our resources because we need to support Android 5 and 6.

I've read the docs and confirm that the new locale format should work. We use the old one, pre-Android 7 for our resources because we need to support Android 5 and 6.
Author
Member

mentioned in merge request !3619

mentioned in merge request !3619
biodranik (Migrated from github.com) approved these changes 2025-03-22 17:58:27 +00:00
Sign in to join this conversation.
No reviewers
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: organicmaps/organicmaps#3584
No description provided.