![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
around-the-world
Advanced tools
around-the-world
Simple to use ICU localization library built on MessageFormat
around-the-world
is a utility library built on top of MessageFormat that makes it it simple to localize your app.
With yarn
:
yarn add around-the-world
With npm
:
npm install --save around-the-world
import aroundTheWorld from 'around-the-world';
(async () => {
const { localize } = await aroundTheWorld({
loadLocale: locale => {
if (locale === 'en-US') {
return {
hello_world: 'Hello, world!',
};
}
throw new Error('Unknown locale!');
},
});
})();
You can easily fetch string tables from your server using the loadLocale
function. It must resolve to an object.
const { localize } = await aroundTheWorld({
loadLocale: async locale => {
const response = await fetch(`/i18n/${locale}.json`);
return res.json();
},
});
localize('hello-world');
You can specify the default locale to load using defaultLocale
. If you don't supply this, navigator.locale
is used.
const { localize } = await aroundTheWorld({
loadLocale: locale => { /* ... */ }
defaultLocale: 'en-AU',
});
You can read the current locale at any time by calling getCurrentLocale()
, and you can set it by calling setCurrentLocale()
. The latter returns a promise that resolves once the locale is loaded.
const {
localize,
getCurrentLocale,
setCurrentLocale,
} = await aroundTheWorld({
loadLocale: locale => {
/* ... */
},
});
getCurrentLocale(); // 'en-AU'
localize('hello'); // 'Hello'
await setCurrentLocale('jp');
localize('hello'); // 'こんにちは'
MessageFormat
supports custom formatters, and you can use them with this library!
const { localize } = await aroundTheWorld({
loadLocale: locale => ({ number: '{value, decimal, 2}' })
formatters: {
decimal: (value, locale, arg) => value.toFixed(+arg),
},
});
localize('number', { value: 12.3456 }); // -> '12.35'
FAQs
Localization library built for MessageFormat
The npm package around-the-world receives a total of 2 weekly downloads. As such, around-the-world popularity was classified as not popular.
We found that around-the-world demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.