Skip to content

Commit b2b525c

Browse files
committed
EddyVerbruggen#93 - Added troubleshooting for android WebView reseting locale issue
1 parent f837c8e commit b2b525c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,19 @@ constructor(
181181
setTimeout(() => this.changeDetectorRef.detectChanges(), 0);
182182
}
183183
```
184+
### Starting from Android N, there is a weird side effect while using a WebView.
185+
For unknown reasons, the very first creation of it resets the application locale to the device default. Therefore, you have to set the desired locale back.
186+
This is native bug and the workaround is
187+
```xml
188+
<WebView url="https://someurl.com" @loaded="webViewLoaded"/>
189+
```
190+
```javascript
191+
import {overrideLocale, androidLaunchEventLocalizationHandler} from "nativescript-localize/localize";
192+
import {getString} from '@nativescript/core/application-settings';
193+
const locale = getString('__app__language__')
194+
195+
function webViewLoaded(){
196+
overrideLocale(locale)
197+
androidLaunchEventLocalizationHandler()
198+
}
199+
```

0 commit comments

Comments
 (0)