expo-localization
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -1,3 +0,3 @@ | ||
import { NativeModulesProxy } from 'expo-core'; | ||
import { NativeModulesProxy } from '@unimodules/core'; | ||
export default NativeModulesProxy.ExpoLocalization; | ||
//# sourceMappingURL=ExpoLocalization.js.map |
@@ -12,4 +12,3 @@ import * as rtlDetect from 'rtl-detect'; | ||
this.locales[0]; | ||
// The native format is en-US | ||
return locale.replace('_', '-'); | ||
return locale; | ||
}, | ||
@@ -16,0 +15,0 @@ get locales() { |
import { Localization } from './Localization.types'; | ||
export declare const locale: any; | ||
export declare const locale: string; | ||
export declare const locales: any; | ||
@@ -4,0 +4,0 @@ export declare const timezone: any; |
import ExpoLocalization from './ExpoLocalization'; | ||
export const locale = ExpoLocalization.locale; | ||
export const locales = ExpoLocalization.locales; | ||
// Web, Android, and some iOS values use `-`. This will convert the iOS values that use `_` | ||
// https://github.com/expo/expo/blob/21ae94bae2e8369992050c433a00699d425b35bd/packages/expo/src/Localization.ts#L112-L114 | ||
const parseLocale = (locale) => locale.replace('_', '-'); | ||
export const locale = parseLocale(ExpoLocalization.locale); | ||
export const locales = ExpoLocalization.locales.map(parseLocale); | ||
export const timezone = ExpoLocalization.timezone; | ||
@@ -9,4 +12,9 @@ export const isoCurrencyCodes = ExpoLocalization.isoCurrencyCodes; | ||
export async function getLocalizationAsync() { | ||
return await ExpoLocalization.getLocalizationAsync(); | ||
const { locale, locales, ...localization } = await ExpoLocalization.getLocalizationAsync(); | ||
return { | ||
locale: parseLocale(locale), | ||
locales: ExpoLocalization.locales.map(parseLocale), | ||
...localization, | ||
}; | ||
} | ||
//# sourceMappingURL=Localization.js.map |
{ | ||
"name": "expo-localization", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Provides an interface for native user localization information.", | ||
"main": "build/Localization.js", | ||
"types": "build/Localization.d.ts", | ||
"sideEffects": false, | ||
"scripts": { | ||
@@ -42,3 +43,3 @@ "build": "expo-module build", | ||
"unimodulePeerDependencies": { | ||
"expo-core": "*" | ||
"@unimodules/core": "*" | ||
}, | ||
@@ -48,3 +49,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "9132f99f2ceb431006060c7f89d0928cc2053897" | ||
"gitHead": "8413e821076a2eca36b302e68dd628ce2e1f591a" | ||
} |
@@ -46,3 +46,3 @@ # expo-localization | ||
```java | ||
import expo.modules.expo.modules.localization.LocalizationPackage; | ||
import expo.modules.localization.LocalizationPackage; | ||
``` | ||
@@ -49,0 +49,0 @@ ```java |
@@ -1,3 +0,3 @@ | ||
import { NativeModulesProxy } from 'expo-core'; | ||
import { NativeModulesProxy } from '@unimodules/core'; | ||
export default NativeModulesProxy.ExpoLocalization; |
@@ -16,5 +16,3 @@ import * as rtlDetect from 'rtl-detect'; | ||
this.locales[0]; | ||
// The native format is en-US | ||
return locale.replace('_', '-'); | ||
return locale; | ||
}, | ||
@@ -21,0 +19,0 @@ get locales(): string[] { |
@@ -5,4 +5,8 @@ import ExpoLocalization from './ExpoLocalization'; | ||
export const locale = ExpoLocalization.locale; | ||
export const locales = ExpoLocalization.locales; | ||
// Web, Android, and some iOS values use `-`. This will convert the iOS values that use `_` | ||
// https://github.com/expo/expo/blob/21ae94bae2e8369992050c433a00699d425b35bd/packages/expo/src/Localization.ts#L112-L114 | ||
const parseLocale = (locale: string): string => locale.replace('_', '-'); | ||
export const locale = parseLocale(ExpoLocalization.locale); | ||
export const locales = ExpoLocalization.locales.map(parseLocale); | ||
export const timezone = ExpoLocalization.timezone; | ||
@@ -14,3 +18,8 @@ export const isoCurrencyCodes = ExpoLocalization.isoCurrencyCodes; | ||
export async function getLocalizationAsync(): Promise<Localization> { | ||
return await ExpoLocalization.getLocalizationAsync(); | ||
const { locale, locales, ...localization } = await ExpoLocalization.getLocalizationAsync(); | ||
return { | ||
locale: parseLocale(locale), | ||
locales: ExpoLocalization.locales.map(parseLocale), | ||
...localization, | ||
}; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
426
0
27098