Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
akili-localization
Advanced tools
Localization service for Akili framework.
import Akili from 'akili';
import localization from 'akili-localization';
const dictionaryEN = {
hello: "world",
languages: {
en: "english",
ru: "russian"
},
how: "from %% to %%",
when "at {{ time }} o'clock"
};
const dictionaryRU = {
hello: "привет"
};
localization.define({
defaultLocale: "en",
currentLocale: "ru"
});
localization.addDict("en-US", dictionaryEN);
localization.addDict("ru", dictionaryRU);
document.addEventListener('DOMContentLoaded', () => {
Akili.init().catch((err) => console.error(err));
});
<div>${ translate('hello') }</div>
<div>${ translate('languages.en') }</div>
<div>${ translate('how', [1, 10]) }</div>
<div>${ translate('when', { time: 5 }) }</div>
<div>${ date(new Date('1995-12-17T03:24:00')) }</div>
<div>${ currency(1250000.99, 'USD') }</div>
<div>${ number(1250000.99) }</div>
After the compilation:
<div>привет</div>
<div>english</div>
<div>from 1 to 10<div>
<div>at 5 o'clock</div>
<div>17.12.1995</div>
<div>1 250 000,99 $</div>
<div>1 250 000,99</div>
You can change the default or current locale any time you want and all expressions in templates will be updated.
The service based on localizationjs.
.define() method take localizationjs options, create an instance of the library class and put it on locale property in the service object. In addition, the service has all the same methods as localizationjs.
localization.setDefaultLocale('es');
localization.setCurrentLocale('fr');
localization.hasTranslation('hello');
// ...
If you load the component as a script, you will have Akili.services.localization to get it.
FAQs
Localiztion service for Akili framework
The npm package akili-localization receives a total of 0 weekly downloads. As such, akili-localization popularity was classified as not popular.
We found that akili-localization 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.