Skip to content
/ cli Public

software localization made easy. Inline default phrases, auto-extract to JSON, and translate seamlessly. Speak globally, code effortlessly. 🌍✨

License

Notifications You must be signed in to change notification settings

ubersetzjs/cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

62 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 ubersetz.js

πŸš€ Welcome to ubersetz.js!

Tired of juggling localization files? Want to make your software globally friendly without the fuss? Ubersetz.js is here to redefine your localization game!

Why choose ubersetz.js? πŸ€”

  • Inline Translations: Write your default language phrase alongside the phrase key directly in your code. No more hopping between files!
  • Automated Extraction: Just set it up and let ubersetz.js find and store your phrases into a neat JSON file.
  • Your Software, Many Languages: Start translating and make your software accessible to users worldwide in their native tongues. 🌐 With ubersetz.js, make your software not just multi-functional, but multi-lingual! πŸŽ‰

Installation

  $ npm install ubersetz

Usage

configuration

create a file called .ubersetzrc in the root of your application

{
  "baseLocale": "en",
  "extractionFile": "locales/extracted.json",
  "locales": [{
    "name": "English (US)",
    "code": "en-us",
    "file": "locales/en.locales.json"
  }, {
    "name": "German",
    "code": "de-de",
    "file": "locales/de.locales.json"
  }]
}

register/translate a phrase in your code

import u from 'ubersetz'

u('key_of_the_phrase, null, 'This is the translation in your default language')

// you can include variables too!
u('key_of_another_phrase, { name }, 'Hello {name}!')

extract phrases

  $ npx @ubersetz/cli .

get/change the locale

import { getLocale, setLocale }  from 'ubersetz'

console.log(getLocale()) // returns the current locale

setLocale('de', await import('./locales/de.locales.json')) // sets the locale and phrases

License

Licensed under MIT license. Copyright (c) 2023 Max Nowack

Contributions

Contributions are welcome. Please open issues and/or file Pull Requests.

Maintainers

Happy localizing! ✨

About

software localization made easy. Inline default phrases, auto-extract to JSON, and translate seamlessly. Speak globally, code effortlessly. 🌍✨

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published