![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
around-the-world
Advanced tools
around-the-world
Simple to use ICU localization library built for MessageFormat
around-the-world
is a utility library built for 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
You can easily fetch string tables from your server using the loadLocale
function and dynamic imports.
The format is expected to be produced by the MessageFormat compiler.
const { localize } = await aroundTheWorld({
loadLocale: locale => import(`/i18n/${locale}.js`),
});
localize('hello-world');
You can compile ICU messages in the client directly with MessageFormat#compile
.
import aroundTheWorld from 'around-the-world';
import MessageFormat from 'messageformat';
(async () => {
const { localize } = await aroundTheWorld({
loadLocale: locale => {
if (locale === 'en-US') {
const mf = new MessageFormat(locale);
return mf.compile({
hello_world: 'Hello, world!',
});
}
throw new Error('Unknown locale!');
},
});
})();
You can specify the default locale to load using defaultLocale
. If you don't supply this, navigator.language
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'); // 'こんにちは'
FAQs
Localization library built for MessageFormat
The npm package around-the-world receives a total of 0 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.