@digitalartlab/expo-plugin-localization
Version:
Native language switching in your Expo app
27 lines (26 loc) • 1.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const config_plugins_1 = require("expo/config-plugins");
const withAndroidLocalizableGradle_1 = require("./withAndroidLocalizableGradle");
const withAndroidLocalizableManifest_1 = require("./withAndroidLocalizableManifest");
const withAndroidLocalizableResources_1 = require("./withAndroidLocalizableResources");
const withIosLocalizableProject_1 = require("./withIosLocalizableProject");
const withIosLocalizableResources_1 = require("./withIosLocalizableResources");
const withNativeLocaleSwitching = (config, { locales = ["en"] }) => {
config = (0, config_plugins_1.withInfoPlist)(config, (config) => {
config.modResults["LOCALES_SUPPORTED"] = locales.join(",");
return config;
});
config = (0, config_plugins_1.withAndroidManifest)(config, (config) => {
const mainApplication = config_plugins_1.AndroidConfig.Manifest.getMainApplicationOrThrow(config.modResults);
config_plugins_1.AndroidConfig.Manifest.addMetaDataItemToMainApplication(mainApplication, "LOCALES_SUPPORTED", locales.join(","));
return config;
});
config = (0, withIosLocalizableProject_1.withIosLocalizableProject)(config, { locales });
config = (0, withIosLocalizableResources_1.withIosLocalizableResources)(config, { locales });
config = (0, withAndroidLocalizableGradle_1.withAndroidLocalizableGradle)(config, { locales });
config = (0, withAndroidLocalizableManifest_1.withAndroidLocalizableManifest)(config);
config = (0, withAndroidLocalizableResources_1.withAndroidLocalizableResources)(config, { locales });
return config;
};
exports.default = withNativeLocaleSwitching;