Skip to content

Instantly share code, notes, and snippets.

@foloinfo
Last active July 8, 2022 06:43
Show Gist options
  • Save foloinfo/9eed8fe9b31c0b085238e9204462bc9e to your computer and use it in GitHub Desktop.
Save foloinfo/9eed8fe9b31c0b085238e9204462bc9e to your computer and use it in GitHub Desktop.
Imgly video / photo editor SDK android localization setup with Expo development build.
  1. Make a custom plugin file
// withTranslation.js
const { AndroidConfig, withStringsXml } = require('@expo/config-plugins')

const withTranslation = (expoConfig) => {
  return withStringsXml(expoConfig, (modConfig) => {
    modConfig.modResults = AndroidConfig.Strings.setStringItem(
      [
        // find keys from https://github.com/imgly/pesdk-android-demo/tree/master/default_res_files/v_10_0/res/values
        { $: { name: 'pesdk_editor_title_name', }, _: '編集', },
        { $: { name: 'pesdk_editor_text_exportProgressUnknown', }, _: '書き出し中', },
      ],
      modConfig.modResults
    )
    return modConfig
  })
}

module.exports = withTranslation
  1. add config to plugins
// app.config.js
module.exports = ()=> ({
  name: 'yourapp',
  //...
  plugins: [
    "react-native-imglysdk",
    "./withTranslation.js",
  ],
})

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment