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

Published Internal Testing Expo App Name is Not Localized #2

Open
Dulatech opened this issue Jun 30, 2022 · 9 comments
Open

Published Internal Testing Expo App Name is Not Localized #2

Dulatech opened this issue Jun 30, 2022 · 9 comments

Comments

@Dulatech
Copy link

I currently have a standalone android app built using 'expo build:android'. However the app name is not localized when published through the Google Play Console as an internal testing app. I have followed all of the instructions in the README.

I ran 'expo prebuild' without any issues and was able to generate the /values and /values-fr folders with the correct strings in the strings.xml files inside each respective folder.

My app.config.js file has the following structure:

import withAndroidLocalizedName from '@mmomtchev/expo-android-localized-app-name';

export default {
  name: "my app",
  slug: "slug",
  version: "1.0.0",
  platforms: ["ios", "android"],
  locales: {
    fr: "./permissions/french.json"
  },
  assetBundlePatterns: ["**/*"],
  ios: {
    infoPlist: {
      CFBundleAllowMixedLocalizations: true
    },
  },
  web: {
    favicon: "./assets/favicon.png"
  },
  plugins: [["test-plugin"], [withAndroidLocalizedName]],
  ...
}

My french.json file has the following structure:

{
  "CFBundleDisplayName": "mon app",
  "app_name": "mon app",
}

Please advise, any help would be appreciated.

@mmomtchev
Copy link
Owner

Your configuration looks ok, do you get any errors when building? Also, can you run expo prebuild and post the contents of android/app/src/main/res/values-fr/strings.xml?

@Dulatech
Copy link
Author

Dulatech commented Jul 4, 2022

I had no errors when building. When I ran expo prebuild the android/app/src/main/res/values-fr/strings.xml had the following content:

<resources>
    <string name="app_name">mon app</string>
</resources>

@mmomtchev
Copy link
Owner

Do you also have android/app/src/main/res/values/strings.xml?

@Dulatech
Copy link
Author

Dulatech commented Jul 6, 2022

Yes this is my android/app/src/main/res/values/strings.xml file

<resources>
  <string name="app_name">my app</string>
  <string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
  <string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
</resources>

@mmomtchev
Copy link
Owner

Everything looks ok.
Do you have any other plugins? Can you also post your AndroidManifest.xml?

@Dulatech
Copy link
Author

Dulatech commented Jul 6, 2022

I had one other plugin, which I removed. I built the app again without issue.

Here is my AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="...">
  <uses-permission android:name="android.permission.CAMERA"/>
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  <uses-permission android:name="android.permission.RECORD_AUDIO"/>
  <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
  <uses-permission android:name="android.permission.USE_BIOMETRIC"/>
  <uses-permission android:name="android.permission.USE_FINGERPRINT"/>
  <uses-permission android:name="android.permission.VIBRATE"/>
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <queries>
    <intent>
      <action android:name="android.intent.action.VIEW"/>
      <category android:name="android.intent.category.BROWSABLE"/>
      <data android:scheme="https"/>
    </intent>
  </queries>
  <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
    <meta-data android:name="expo.modules.notifications.default_notification_color" android:resource="@color/notification_icon_color"/>
    <meta-data android:name="expo.modules.notifications.default_notification_icon" android:resource="@drawable/notification_icon"/>
    <meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
    <meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="44.0.0"/>
    <meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
    <meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
    <meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="..."/>
    <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustPan" android:theme="@style/Theme.App.SplashScreen" android:screenOrientation="portrait">
      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
      <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="..."/>
      </intent-filter>
    </activity>
    <activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/>
  </application>
</manifest>

@mmomtchev
Copy link
Owner

I see that you are in Canada, can you try this:
https://stackoverflow.com/questions/6676393/localization-codes-does-not-work

@Dulatech
Copy link
Author

Dulatech commented Jul 7, 2022

I added the following locales to my app.config.js.

locales: {
      fr: "./permissions/french.json",
      fr-rFR: "./permissions/french.json",
      fr-rCA: "./permissions/french.json"
},

I was able to generate values folders when running expo prebuild, i.e android/app/src/main/res/values-fr-rCA/strings.xml, each containing the following:

<resources>
    <string name="app_name">mon app</string>
</resources>

The published app name is still not translated however when switching my language to French (Canada) on my Android device.

@mmomtchev
Copy link
Owner

Can you also add an explicit English language translation different from the default one and tell me if you get the default one or the English one when you switch to English?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants