Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cobrowse-agent-ui

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cobrowse-agent-ui

## Localization

  • 1.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
2
Weekly downloads
 
Created
Source

Cobrowse Agent UI

Localization

Change active locale at runtime

The project that's using the agent-ui can dictate which locale to use in our components. Below is an example of how to achieve this from an app that's also using i18next to handle localization.

// i18n.js

import i18n from 'i18next';
import { i18n as i18nAgentUI } from 'cobrowse-agent-ui';

i18n.init({
  // ...
});

i18n.on('languageChanged', (language) => {
  i18nAgentUI.changeLanguage(language);
});

export default i18n;

Adding new locales

To add a new locale follow these steps:

  • Add a new entry to the locales array inside i18next-parser.config.js.
  • Run the npm run i18n command to generate a new locale file.
  • Import the new locale JSON file inside src/i18n.js and add it to the resources object (in the i18n instance configuration) keyed by the locale key.
  • Import the relevant moment locale inside src/i18n.js.
  • Add a new entry to the SUPPORTED_LOCALES constant inside src/i18n.js.

Note: ensure the locale code matches the ones provided by the moment library as these are used to localize dates as well.

FAQs

Package last updated on 17 Jan 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc