EddyVerbruggen/nativescript-localize

RESTART automatically a nativescript 8 angular app after close -exit or finish - that app to change the app language

Opened this issue · 0 comments

I'm wondering if there is a way to automatically restart the app after an exit in IOS or a finish in android used to change the app language.

To be more precise, in the official NS documentation (https://docs.nativescript.org/plugins/localize.html#how-to-change-the-language-dynamically-at-runtime ) I found this code (see below alert ...) I wish to complete ????? (see code below) with a method (if is possible) that will RESTART the app after close.

`import { Application } from '@nativescript/core'
import { overrideLocale } from '@nativescript/localize'

alert({
title: 'Switch Language',
message: 'The application needs to be restarted to change language',
okButtonText: 'Quit!'
}).then(() => {
L.localize.overrideLocale(selectedLang)
if (isAndroid) {
;(
Application.android.foregroundActivity || Application.android.startActivity
).finish()

// Here I need a method to RESTART the app automatically after finsih
?????

} else {
exit(0)
// Here I need a method to RESTART the app automatically after exit
?????
}
})`