Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to set the default language? #11

Closed
magar91 opened this issue Aug 26, 2016 · 7 comments
Closed

Any way to set the default language? #11

magar91 opened this issue Aug 26, 2016 · 7 comments

Comments

@magar91
Copy link

magar91 commented Aug 26, 2016

In my app I have two languages spanish and english but I want to make spanish the default language in case that the device has any other language. Is there any way to set a default language?

@rborn
Copy link
Collaborator

rborn commented Aug 28, 2016

I'm not sure, I'll have to investigate :)

@ahmedelgendy
Copy link

+1

@lukashlobil
Copy link
Contributor

I haven't investigated for iOS, but this is postinstall for Android. English is forced to be default language.

if (lang === 'en') {
    outputFile = path.join(appResourcesDirectoryPath, 'Android', 'values', 'strings.xml');
} else {
    outputFile = path.join(appResourcesDirectoryPath, 'Android', 'values-' + lang, 'strings.xml');
}

Removing the if clause enables english not to default (there would be values-en). Then we'd need to read the default language string (ie. from package.json) and do the if clause for that language.

@rborn
Copy link
Collaborator

rborn commented Jan 17, 2017

@lukashlobil yes, this is the approach I wanna take, only that I was very busy. Gimme few days to try to find some time to do this 😄

@rborn
Copy link
Collaborator

rborn commented Jan 17, 2017

@lukashlobil
Copy link
Contributor

lukashlobil commented Jan 17, 2017

@rborn oh, cool!
I forked it and implemented default language (settable in package.json) both with custom location and without custom location. Looks good so far. I will do some tests, fix formatting and will do PR tomorrow . Let me know what you think if you can.

@rborn
Copy link
Collaborator

rborn commented Jan 17, 2017

@lukashlobil looks good 😄

if you want you can bump the version to 0.1.0 (as I think the module can be considered out of beta now), update the readme with the info about the defaultLang and I'll review the PR and push it to npm if all ok.

thanks again 👍

This was referenced Jan 23, 2017
@rborn rborn closed this as completed Jan 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants