The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Don't depend on the
localStorage
API to exist in the environment. Ensures compatibility with Android WebView. #154 - @UshakovVasilii
- The
currentLanguage
getter now returns the correct language. If language detection is enabled, it will return the detected language by default or otherwise the default language.
- Added compatibility for older browsers (including Safari 9) by using
Array.from
to convert a NodeList into an array.
- Added more CodeSandbox examples to the documentation's example section.
- This release is a complete rewrite of the codebase.
- The methods
load()
andgetTranslationByKey()
have been removed in favor of a new API. Usefetch()
,translateForKey()
, andtranslatePageTo()
instead. - The config option
languages
has been removed. - For more documentation on the new API, see the Usage section or the API Reference.
- Added a config option
registerGlobally
that, if specified, registers a global helper with the same name as the given value. This allows you to translate single strings using shortcuts like__('header.title')
. - Added a config option
persistKey
that specifies the name of the localStorage key. - Added a config option
debug
that, if set totrue
, prints useful error messages. - Added
fetch()
for easier JSON fetching. - Added
add()
to register new languages to the translator. - Added
remove()
to remove languages from the translator. - Added
translateForKey()
andtranslatePageTo()
to translate single keys or the entire website. - Added
get currentLanguage
to get the currently used language. - Transpiled and minified UMD, ESM and CJS builds are available via unpkg and npm.
- Added a build system for easier packaging and testing.
- Added CONTRIBUTING.md
- Added CODE_OF_CONDUCT.md
- The documentation has been updated and improved.
- The option
languages
has been removed. - The method
load()
has been removed. - The method
getTranslationByKey()
has been removed.
- Install
@babel/[email protected]
, - Install
@babel/[email protected]
, - Install
@babel/[email protected]
, - Install
@babel/[email protected]
, - Install
@rollup/[email protected]
, - Install
[email protected]
, - Install
[email protected]
, - Install
[email protected]
, - Install
[email protected]
, - Install
[email protected]
, - Install
[email protected]
, - Install
[email protected]
, - Install
[email protected]
data-i18n-attr
can now translate multiple attributes by providing a space-separated list. Thanks @gwprice115.
getTranslationByKey
uses the fallback language when provided.- Update the documentation.
- Provide a fallback language using the
options.defaultLanguage
property. - Translate all HTML attributes like
title
orplaceholder
, not only text. - Add the method
getTranslationByKey
to translate a single key programmatically.
- Use cache to translate faster and save network data.
- Print a warning message when a key was not found in the translation files. Thanks @andi34.
- Bump eslint to 6.8.0
- Initial release