├── .husky └── commit-msg ├── app.plugin.js ├── android ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── expo │ │ └── modules │ │ └── pluginlocalization │ │ └── ExpoPluginLocalizationModule.kt └── build.gradle ├── commitlint.config.js ├── .vscode └── settings.json ├── example ├── assets │ ├── icon.png │ ├── favicon.png │ ├── splash.png │ └── adaptive-icon.png ├── tsconfig.json ├── .gitignore ├── App.tsx ├── babel.config.js ├── package.json ├── app.json └── README.md ├── .eslintrc.js ├── .npmignore ├── plugin ├── tsconfig.json └── src │ ├── withAndroidLocalizableManifest.ts │ ├── withIosLocalizableProject.ts │ ├── withAndroidLocalizableResources.ts │ ├── withIosLocalizableResources.ts │ ├── index.ts │ └── withAndroidLocalizableGradle.ts ├── expo-module.config.json ├── tsconfig.json ├── src ├── index.ts └── ExpoPluginLocalizationModule.ts ├── ios ├── ExpoPluginLocalizationModule.swift └── ExpoPluginLocalization.podspec ├── .github └── workflows │ └── release-please.yml ├── SECURITY.md ├── .gitignore ├── package.json ├── CHANGELOG.md ├── README.md └── LICENSE /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | npx --no -- commitlint --edit ${1} 2 | -------------------------------------------------------------------------------- /app.plugin.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./plugin/build"); 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { extends: ["@commitlint/config-conventional"] }; 2 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.codeActionsOnSave": { 3 | "source.fixAll.eslint": "explicit" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /example/assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalartlab/expo-plugin-localization/HEAD/example/assets/icon.png -------------------------------------------------------------------------------- /example/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalartlab/expo-plugin-localization/HEAD/example/assets/favicon.png -------------------------------------------------------------------------------- /example/assets/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalartlab/expo-plugin-localization/HEAD/example/assets/splash.png -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: ["universe/native"], 4 | ignorePatterns: ["build"], 5 | }; 6 | -------------------------------------------------------------------------------- /example/assets/adaptive-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalartlab/expo-plugin-localization/HEAD/example/assets/adaptive-icon.png -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Exclude all top-level hidden directories by convention 2 | /.*/ 3 | 4 | __mocks__ 5 | __tests__ 6 | 7 | /babel.config.js 8 | /commitlint.config.js 9 | /android/src/androidTest/ 10 | /android/src/test/ 11 | /android/build/ 12 | /example/ 13 | -------------------------------------------------------------------------------- /plugin/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "expo-module-scripts/tsconfig.plugin", 3 | "compilerOptions": { 4 | "outDir": "build", 5 | "rootDir": "src" 6 | }, 7 | "include": ["./src"], 8 | "exclude": ["**/__mocks__/*", "**/__tests__/*"] 9 | } 10 | -------------------------------------------------------------------------------- /expo-module.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "platforms": ["ios", "android"], 3 | "ios": { 4 | "modules": ["ExpoPluginLocalizationModule"] 5 | }, 6 | "android": { 7 | "modules": ["expo.modules.pluginlocalization.ExpoPluginLocalizationModule"] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | // @generated by expo-module-scripts 2 | { 3 | "extends": "expo-module-scripts/tsconfig.base", 4 | "compilerOptions": { 5 | "outDir": "./build" 6 | }, 7 | "include": ["./src"], 8 | "exclude": ["**/__mocks__/*", "**/__tests__/*"] 9 | } 10 | -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "expo/tsconfig.base", 3 | "compilerOptions": { 4 | "strict": true, 5 | "paths": { 6 | "expo-plugin-localization": ["../src/index"], 7 | "expo-plugin-localization/*": ["../src/*"] 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import ExpoPluginLocalizationModule from "./ExpoPluginLocalizationModule"; 2 | 3 | export function getLocales(): string[] { 4 | const localesString: string = ExpoPluginLocalizationModule.getLocales(); 5 | const locales = localesString.split(","); 6 | 7 | return locales; 8 | } 9 | -------------------------------------------------------------------------------- /src/ExpoPluginLocalizationModule.ts: -------------------------------------------------------------------------------- 1 | import { requireNativeModule } from "expo-modules-core"; 2 | 3 | // It loads the native module object from the JSI or falls back to 4 | // the bridge module (from NativeModulesProxy) if the remote debugger is on. 5 | export default requireNativeModule("ExpoPluginLocalization"); 6 | -------------------------------------------------------------------------------- /ios/ExpoPluginLocalizationModule.swift: -------------------------------------------------------------------------------- 1 | import ExpoModulesCore 2 | 3 | public class ExpoPluginLocalizationModule: Module { 4 | public func definition() -> ModuleDefinition { 5 | Name("ExpoPluginLocalization") 6 | 7 | Function("getLocales") { 8 | return Bundle.main.object(forInfoDictionaryKey: "LOCALES_SUPPORTED") as? String 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.github/workflows/release-please.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: 4 | - main 5 | 6 | permissions: 7 | contents: write 8 | pull-requests: write 9 | 10 | name: release-please 11 | 12 | jobs: 13 | release-please: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: google-github-actions/release-please-action@v3 17 | with: 18 | release-type: node 19 | package-name: "@digitalartlab/expo-plugin-localization" 20 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files 2 | 3 | # dependencies 4 | node_modules/ 5 | 6 | # Expo 7 | .expo/ 8 | dist/ 9 | 10 | # Native 11 | *.orig.* 12 | *.jks 13 | *.p8 14 | *.p12 15 | *.key 16 | *.mobileprovision 17 | 18 | # Metro 19 | .metro-health-check* 20 | 21 | # debug 22 | npm-debug.* 23 | yarn-debug.* 24 | yarn-error.* 25 | 26 | # macOS 27 | .DS_Store 28 | *.pem 29 | 30 | # local env files 31 | .env*.local 32 | 33 | # typescript 34 | *.tsbuildinfo 35 | 36 | # prebuild 37 | ios 38 | android 39 | -------------------------------------------------------------------------------- /example/App.tsx: -------------------------------------------------------------------------------- 1 | import * as Linking from "expo-linking"; 2 | import { getLocales } from "expo-plugin-localization"; 3 | import { Button, Text, View } from "react-native"; 4 | 5 | export default function App() { 6 | return ( 7 | 8 | 9 | Supported locales:{" "} 10 | {getLocales() 11 | .map((locale) => locale) 12 | .join(", ")} 13 | 14 |