NativeScript / NativeScript/plugins

Android and iOS Application's language does not match

Open
#533 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
206
Forks
123
Avg merge
2d 1h
Merged PRs (30d)
1

Description

I have implemented the localize plugin, and Im' facing issues:

"get the default language on user's phone via the language property of the Device class."

I have Android which phone language setting is set United Kingdom (en) this picks up correctly. On iOS I also have the setting language to English as preferred language but this isn't printing correctly. I the following code.

    console.log('DEVICE LANGUAGE', device.language);
    console.log('From Cores, Device.language);
    console.log('from __app__language__', ApplicationSettings.getString('__app__language__'))
    const localeOverriddenSuccessfully = overrideLocale(Device.language); 

On Android is correct:
Screenshot 2023-09-29 at 11 45 25

On iOS is incorrect:
Screenshot 2023-09-29 at 11 45 10
Screenshot 2023-09-29 at 11 43 00

ns --version
8.5.3
✔ Up to date.

Angular:
ng version

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | '_ \ / | | | | |/ _ | '__| | | | | | |
/ ___ | | | | (
| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/

Angular CLI: 15.2.8
Node: 20.4.0 (Unsupported)
Package Manager: npm 9.7.2
OS: darwin x64

Angular: 15.1.5
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1501.6
@angular-devkit/build-angular 15.1.6
@angular-devkit/core 15.1.6
@angular-devkit/schematics 15.2.8
@angular/cli 15.2.8
@ngtools/webpack 15.1.6
@schematics/angular 15.2.8
rxjs 7.6.0
typescript 4.8.4

=============================================
It seems to me that on iOS some how it cached into the the phone's default language variables, earlier on I was manually updating the language like so:
const localeOverriddenSuccessfully = overrideLocale('nl');
could this have been cached for iOS on this variables prior?

device.language
Device.language
__app__language__

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the discrepancy on Android and iOS using the shown Device.language, device.language, ApplicationSettings.getString('app__language'), and overrideLocale calls. Compare the returned values after changing the device language and after manually overriding the locale; done means the cause is identified and the issue's expected iOS behavior is fixed or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, ios, typescript
Domain
localization, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.