1.0.2 • Published 7 months ago

hivtrace-locales v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 months ago

HIVTRACE Locales

Overview

This package is a language support module for HIVTRACE-GO and hivtrace-viz, built to work with i18next. It contains JSON files (en.json, es.json) for multiple languages.

How to Use

Installation

npm install hivtrace-locales

Usage with i18next in Raw JavaScript

Initialize i18next:

import i18next from 'i18next';

i18next.init({
  resources: {
    en: {
      translation: require('<path_to_en.json>')
    },
    es: {
      translation: require('<path_to_es.json>')
    }
  },
  lng: 'en',
  fallbackLng: 'en'
});

Retrieve localized strings:

const localizedString = i18next.t('key_from_json');

Usage in Svelte

In Svelte, you can use i18next similarly:

import i18next from 'i18next';

i18next.init({
  // ... (same as above)
});

const localizedString = i18next.t('key_from_json');

Replace 'key_from_json' with the appropriate key from the language JSON files.

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago

0.1.0

5 years ago