Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

strings xml Locale not changing

Tags:

android

locale

The problem I am having is when launching the application in another locale for example "de" the program is not using the strings.xml (de) which it is meant to use.

Layout of 'values' directory screenshot

UPDATE: The "en" locale file works and the app successfully uses the strings of this file but when setting to another language the application reverts back to the default strings.xml file. I have even set the files to the exact same and still no luck.

EDIT: Fixed this problem by finding the following in my application build gradle! resConfigs "en"

like image 723
Louis Ferraiolo Avatar asked Aug 03 '17 08:08

Louis Ferraiolo


1 Answers

SOLUTION: Changed the app gradle script. It had initially had resConfigs "en" which was preventing any other locale to work so I removed the line. It is inside the default config.

Before:

android {
    compileSdkVersion 19
    buildToolsVersion '25.0.0'
    defaultConfig {
        applicationId 'com.xxxx.xxxx'
        minSdkVersion 19
        targetSdkVersion 19
        versionCode 1000
        versionName '1.05'
        resConfigs "en"
    }
}  

After:

android {
    compileSdkVersion 19
    buildToolsVersion '25.0.0'
    defaultConfig {
        applicationId 'com.xxxx.xxxx'
        minSdkVersion 19
        targetSdkVersion 19
        versionCode 1000
        versionName '1.05'
    }
}    
like image 162
Louis Ferraiolo Avatar answered Oct 15 '22 11:10

Louis Ferraiolo