Skip to content

Releases: ChristophP/elm-i18next

Adding `customTr` and `customTrf`

17 Dec 23:00
Compare
Choose a tag to compare

Now it's possible to have placeholders and replace them with things other than string such as Html. This feature helps so that translators don't have to break up their text into little pieces when the text contains markup such as a link for example.

Thanks @csicar for suggesting the feature and providing much of the implementation.

Adding custom translation constructors

14 Jan 20:26
fe7bdf7
Compare
Choose a tag to compare

This release adds the possibility for users to build their own translations without decoding JSON.

  • exposes functions to construct a Translations type
  • do some internal refactoring
  • make decoder fail if it is passed a string instead of an object

No more http dependency, some meta functions

11 Dec 06:42
Compare
Choose a tag to compare
  • Removes fetchTranslations and the dependency on elm/http. Since the elm compiler does not support having multiple version of the same library it is better not to depend on elm/http so that users can choose more freely whether to use elm/http version 1 or 2. Also, I assume that fetchTranslations was not highly used and can easily be built by users.
  • Add keys and hasKey function. This should not be needed for regular applications but exposing them allows makers of translation editors to query for missing keys or check if keys exists.
  • Add a proper example, in which the default case is passing the translations via flags. The case where Elm makes an Http request for the translations file should be added soon.

Update tests and examples for 0.19

11 Nov 16:59
30491e0
Compare
Choose a tag to compare
Merge pull request #10 from ChristophP/adjust-tests-and-docs-for-19

Adjust tests and docs for 19

2.0.0

17 May 20:33
Compare
Choose a tag to compare
  • Fix another bug in the decoder that was producing wring keys in the decoded translations.
  • Make the Translations type opaque
  • Add tr function for translating with replacements(placeholders).
  • Add tf function for translating while uses fallback languages.
  • Add trf function for using replacements(placeholders) and fallback languages at the same time.
  • change API to "translations first" for easier use with pipelines.
  • improve docs and readme.

Fix another decoder bug

17 May 11:57
Compare
Choose a tag to compare

This patch fixes antother bug in the decoder that messed up nested translations.

Fix decoder bug

07 May 20:21
Compare
Choose a tag to compare

This patch fixes a bug that existed in the decoder for the translation files. The namespace was cleared for all nested keys expect the first one.
With the bug a JSON file like this :

{
  "a": {
    "b": "hello",
    "c": "bye"
  }
}

was decoded into Dict.fromList [("a.b","Hello"),("c","bye")] instead of Dict.fromList [("a.b","Hello"),("b.c","bye")].

Decoding now works properly for all nested keys.