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

vanilla-i18n

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vanilla-i18n

Translating text in a simple and easy way.

  • 1.0.5
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

vanilla-i18n

Translating text in a simple and easy way.


How to use?

  // I18nPtBr.js
  const i18n = require('./vanilla-i18n')

  i18n.setTranslate({
    'myfirstname': 'Agrupador',
    'mymiddlename': 'Opção de resposta',
    'mylastname': 'Opção única',
    'myfullname': 'Opções múltiplas',
    'othen i18n': 'Área de texto',
    'somebody text': 'Texto resumido'
  }, 'pt')

  i18n.setDefaultLanguage('pt')
  // I18nEn.js
  const i18n = require('./vanilla-i18n')

  i18n.setTranslate({
    'myfirstname': 'My First name',
    'mymiddlename': 'My middle name',
    'mylastname': 'My Last name',
    'myfullname': 'My full name',
    'other i18n': 'Other translation',
    'somebody text': 'Other somebody texto'
  }, 'en')
  // code.js
  const myFirstNameEn = 'myfirstname'.translate('en')
  const myFirstNamePtBr = 'myfirstname'.translate('pt')
  const myFirstNameDefault = 'myfirstname'.translate()

  console.log({
    en: myFirstNameEn,
    pt: myFirstNamePtBr,
    default: myFirstNameDefault
  })
  // main.js
  require('./I18nEn')
  require('./I18nPtBr')
  require('./code.js')

Keywords

FAQs

Package last updated on 07 Nov 2017

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