Skip to content

Commit

Permalink
1.1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
eddow committed Jun 23, 2024
1 parent c607eda commit 5d6b8ea
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@

## Added:

- `duration` processor
- `duration` processor
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ The main documentation is in [the repository](./docs/README.md)
## Another internationalization library ... ?

After re-implementing again and again internationalization as I was happy with none, I built up the minimum requirements I'd ask an 18n library to do:
- Having a json-file (or alike) per language is perfect when the website/web-app is done. Nowadays, applications are *never* done, there is always a bug to fix, an error to add, a new functionality to implement, ... Most go through a shared document with "new keys to translate" or, worst, use the english sentence as a key and, after some typos, the sentence is translated in some language only after a user has reported it. A complete i18n library ought to offer a centralized way for coders to manage keys that allow translators to know what has to be translated, what has been modified (imagine the fuss when a dev changes a bit the meaning of an entry)

- Having a json-file (or alike) per language is perfect when the website/web-app is done. Nowadays, applications are _never_ done, there is always a bug to fix, an error to add, a new functionality to implement, ... Most go through a shared document with "new keys to translate" or, worst, use the english sentence as a key and, after some typos, the sentence is translated in some language only after a user has reported it. A complete i18n library ought to offer a centralized way for coders to manage keys that allow translators to know what has to be translated, what has been modified (imagine the fuss when a dev changes a bit the meaning of an entry)
- Even if interpolation is based on a [regular language](https://en.wikipedia.org/wiki/Regular_language) and not a [context-free one](https://en.wikipedia.org/wiki/Context-free_language), it should allow wide customization, even JS(/TS) processors to be implemented by the developer. Also, some interpolation should be done once for all (like durations, ...) and use as much as possible the [native Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) capacities
- Changing the displayed language should just retrieve the smallest needed dictionary, not the whole page, and re-translate the page dynamically - especially with modern frameworks like svelte, vue, ... (but not only)
- `Zones` is something I never found in any i18n library: allowing the translator to translate all the texts (emails sent by the server, messages, admin pages, ...) a centralized way, while the programer specifies which text has to be downloaded (or not) by whom (minimum needed dictionary transferred)
Expand Down
2 changes: 1 addition & 1 deletion docs/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ class I18nClient {
displayNames(options: Intl.DisplayNamesOptions): Intl.DisplayNames
dateTimeFormat(options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat
}
```
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "omni18n",
"version": "1.1.16",
"version": "1.1.17",
"exports": {
".": {
"browser": {
Expand Down
7 changes: 6 additions & 1 deletion src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ export { default as I18nClient } from './client'
export * from './client'
export { TranslationError, type ClientDictionary, type Translator } from './types'
export { bulkObject, bulkDictionary } from './helpers'
export { formats, processors, DurationDescription, DurationOptions } from './interpolation'
export {
formats,
processors,
type DurationDescription,
type DurationOptions
} from './interpolation'

0 comments on commit 5d6b8ea

Please sign in to comment.