Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/enzomanuelmangano/text-localizer
A lightweight, fast and flexible way to handle localized strings
https://github.com/enzomanuelmangano/text-localizer
i18n l10n localization react-native reactjs
Last synced: 12 days ago
JSON representation
A lightweight, fast and flexible way to handle localized strings
- Host: GitHub
- URL: https://github.com/enzomanuelmangano/text-localizer
- Owner: enzomanuelmangano
- Created: 2021-09-08T14:08:53.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-05T14:14:39.000Z (almost 3 years ago)
- Last Synced: 2024-10-27T14:46:18.044Z (15 days ago)
- Topics: i18n, l10n, localization, react-native, reactjs
- Language: TypeScript
- Homepage: https://enzomanuelmangano.github.io/text-localizer/
- Size: 7.56 MB
- Stars: 23
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
📖 Text Localizer_A lightweight, fast and flexible way to handle localized strings._
[**Documentation can be found here.**](https://enzomanuelmangano.github.io/text-localizer/)
## Package Versions
| Name | Latest Version |
| ----------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------: |
| [text-localizer](/packages/core) | [![badge](https://img.shields.io/npm/v/text-localizer.svg?style=flat-square)](https://www.npmjs.com/package/text-localizer) |
| [react-text-localizer](/packages/react) | [![badge](https://img.shields.io/npm/v/react-text-localizer.svg?style=flat-square)](https://www.npmjs.com/package/react-text-localizer) |
| [react-native-text-localizer](/packages/react-native) | [![badge](https://img.shields.io/npm/v/react-native-text-localizer.svg?style=flat-square)](https://www.npmjs.com/package/react-native-text-localizer) |## Motivation
Text Localizer is a package born out of the need to manage translations in a typesafe manner. Currently, the best-known solutions in javascript for managing translations are based on a key-value approach (i18n.js, i18next).
This approach involves this way of accessing the individual translation.
```ts
console.log(translationsObject.get('translations_key'));
```The main problems with this approach are that:
- _There is no effective compile-time support to catch errors if the key is wrong;_
- _There is no way of knowing whether the key being accessed is set for all languages;_
- _There is no warning if you try to access an unsupported locale;_
- _The refactoring of translation keys can easily lead to problems that cannot be intercepted at compile-time._Consequently, the goal of TextLocalizer is to provide a lightweight, fast, and flexible way to access translation strings in a type-safe manner in the JavaScript world.
## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## License
MIT