@digitalartlab/expo-plugin-localization
Version:
Native language switching in your Expo app
20 lines (19 loc) • 879 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.withAndroidLocalizableManifest = void 0;
const config_plugins_1 = require("expo/config-plugins");
/**
* Add reference to the locales_config.xml file in the AndroidManifest.xml
*/
const withAndroidLocalizableManifest = (config) => {
return (0, config_plugins_1.withAndroidManifest)(config, (config) => {
const androidManifest = config.modResults;
const applications = androidManifest.manifest.application;
if (!applications || !applications[0]) {
throw new Error(`Cannot configure localization because the AndroidManifest.xml is missing an <application> tag`);
}
applications[0].$["android:localeConfig"] = "@xml/locales_config";
return config;
});
};
exports.withAndroidLocalizableManifest = withAndroidLocalizableManifest;