diff --git a/build.cmd b/build.cmd
index 9113b87..aeb4645 100644
--- a/build.cmd
+++ b/build.cmd
@@ -3,4 +3,6 @@ rem This bat file minifies all js and css and creates a dist folder with everyth
node node_modules\minifyfromhtml\minifyfromhtml.js --js=dist\myapp.js --css=dist\myapp.css < index.html
copy /Y index.production.html dist\index.html
+copy /Y favicon.ico dist\favicon.ico
xcopy /F /Y /I templates dist\templates
+xcopy /F /Y /I i18n dist\i18n
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 0000000..0e42825
Binary files /dev/null and b/favicon.ico differ
diff --git a/i18n/de.json b/i18n/de.json
new file mode 100644
index 0000000..ab3b82e
--- /dev/null
+++ b/i18n/de.json
@@ -0,0 +1,4 @@
+{
+ "vanillaJS": "vanillaJS Beispiel Projekt",
+ "awesome": "Coole app."
+}
diff --git a/i18n/en.json b/i18n/en.json
new file mode 100644
index 0000000..a196451
--- /dev/null
+++ b/i18n/en.json
@@ -0,0 +1,4 @@
+{
+ "vanillaJS": "vanillaJS seed project",
+ "awesome": "This is an awesome app!"
+}
diff --git a/i18n/it.json b/i18n/it.json
new file mode 100644
index 0000000..6526c74
--- /dev/null
+++ b/i18n/it.json
@@ -0,0 +1,4 @@
+{
+ "vanillaJS": "progetto di esempio vanillaJS",
+ "awesome": "Questa app è fantastica!"
+}
diff --git a/index.html b/index.html
index 1ee7914..20ee127 100644
--- a/index.html
+++ b/index.html
@@ -4,7 +4,7 @@
-
+
@@ -12,15 +12,16 @@
-
-
-
-
-
+
+
+
+
+
+
-
+
diff --git a/js/index.js b/js/index.js
index 7c13dc7..f3a7ee6 100644
--- a/js/index.js
+++ b/js/index.js
@@ -84,6 +84,7 @@
// set language
i18next
.use(i18nextBrowserLanguageDetector)
+ .use(i18nextXHRBackend)
.init({
detection: {
order: ['querystring', 'cookie', 'navigator'],
@@ -94,26 +95,9 @@
},
whitelist: ['en', 'de', 'it'],
nonExplicitWhitelist: true,
- fallbackLng: 'en',
- resources: {
- en: {
- translation: {
- 'vanillaJS': 'vanillaJS seed project',
- 'awesome': 'This is an awesome app!'
- }
- },
- it: {
- translation: {
- 'vanillaJS': 'progetto di esempio vanillaJS',
- 'awesome': 'Questa app è fantastica!'
- }
- },
- de: {
- translation: {
- 'vanillaJS': 'vanillaJS Beispiel Projekt',
- 'awesome': 'Coole app.'
- }
- }
+ fallbackLng: 'it',
+ backend: {
+ loadPath: '/i18n/{{lng}}.json'
}
})
.then(function() {
@@ -124,6 +108,7 @@
//removeURLParameter does not return the hash. add it back if there is one.
newUrl = newUrl + window.location.hash;
window.location = newUrl;
+ return;
}
// render main shell
diff --git a/node_modules/i18next-xhr-backend/.coveralls.yml b/node_modules/i18next-xhr-backend/.coveralls.yml
new file mode 100644
index 0000000..00665ea
--- /dev/null
+++ b/node_modules/i18next-xhr-backend/.coveralls.yml
@@ -0,0 +1 @@
+repo_token: 95SiHydOTG99ngOBBMnlRSl28IgE9kAah
diff --git a/node_modules/i18next-xhr-backend/.travis.yml b/node_modules/i18next-xhr-backend/.travis.yml
new file mode 100644
index 0000000..40d0078
--- /dev/null
+++ b/node_modules/i18next-xhr-backend/.travis.yml
@@ -0,0 +1,6 @@
+language: node_js
+node_js:
+ - "6.2"
+before_script:
+ - npm install -g gulp
+ - npm install -g karma
diff --git a/node_modules/i18next-xhr-backend/CHANGELOG.md b/node_modules/i18next-xhr-backend/CHANGELOG.md
new file mode 100644
index 0000000..c5d9e71
--- /dev/null
+++ b/node_modules/i18next-xhr-backend/CHANGELOG.md
@@ -0,0 +1,53 @@
+### 2.0.1
+
+- typescript: fix types [298](https://github.com/i18next/i18next-xhr-backend/pull/298)
+
+### 2.0.0
+
+- typescript: add types
+
+### 1.5.1
+
+- fixes add path to use `/locales/...`
+
+### 1.5.0
+
+- add .js for browser import implementation [PR268](https://github.com/i18next/i18next-xhr-backend/pull/268)
+
+### 1.4.3
+
+- Fix XML parsing error in Firefox [PR265](https://github.com/i18next/i18next-xhr-backend/pull/265)
+
+### 1.4.2
+
+- usage with sinon [260](https://github.com/i18next/i18next-xhr-backend/pull/260)
+
+### 1.4.1
+
+- fixes ajax
+
+### 1.4.0
+
+- add `queryStringParams` option [PR255](https://github.com/i18next/i18next-xhr-backend/pull/255)
+
+### 1.3.0
+
+- add support for custom headers [PR250](https://github.com/i18next/i18next-xhr-backend/pull/250)
+- update dev dependencies
+
+### 1.2.1
+
+- downgrade babel-preset-es2015-native-modules to correctly build es files
+
+### 1.2.0
+
+- support withCredentials flag on XHR [PR238](https://github.com/i18next/i18next-xhr-backend/pull/238)
+
+### 1.1.0
+
+- allows loadPath to be a function [PR236](https://github.com/i18next/i18next-xhr-backend/pull/236)
+
+### 1.0.1
+
+- change amd export to unnamed
+- initial v1
diff --git a/node_modules/i18next-xhr-backend/LICENSE b/node_modules/i18next-xhr-backend/LICENSE
new file mode 100644
index 0000000..6f6eb63
--- /dev/null
+++ b/node_modules/i18next-xhr-backend/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 i18next
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/node_modules/i18next-xhr-backend/README.md b/node_modules/i18next-xhr-backend/README.md
new file mode 100644
index 0000000..a2dd9ff
--- /dev/null
+++ b/node_modules/i18next-xhr-backend/README.md
@@ -0,0 +1,172 @@
+# Introduction
+
+[](https://travis-ci.org/i18next/i18next-xhr-backend)
+[](https://coveralls.io/github/i18next/i18next-xhr-backend)
+[](https://www.npmjs.com/package/i18next-xhr-backend)
+[]()
+[](https://david-dm.org/i18next/i18next-xhr-backend)
+
+This is a simple i18next backend to be used in the browser. It will load resources from a backend server using xhr.
+
+# Getting started
+
+Source can be loaded via [npm](https://www.npmjs.com/package/i18next-xhr-backend), bower or [downloaded](https://github.com/i18next/i18next-xhr-backend/blob/master/i18nextXHRBackend.min.js) from this repo.
+
+```
+# npm package
+$ npm install i18next-xhr-backend
+
+# bower
+$ bower install i18next-xhr-backend
+```
+
+Wiring up:
+
+```js
+import i18next from 'i18next';
+import XHR from 'i18next-xhr-backend';
+
+i18next
+ .use(XHR)
+ .init(i18nextOptions);
+```
+
+- As with all modules you can either pass the constructor function (class) to the i18next.use or a concrete instance.
+- If you don't use a module loader it will be added to `window.i18nextXHRBackend`
+
+## Backend Options
+
+```js
+{
+ // path where resources get loaded from, or a function
+ // returning a path:
+ // function(lngs, namespaces) { return customPath; }
+ // the returned path will interpolate lng, ns if provided like giving a static path
+ loadPath: '/locales/{{lng}}/{{ns}}.json',
+
+ // path to post missing resources
+ addPath: 'locales/add/{{lng}}/{{ns}}',
+
+ // your backend server supports multiloading
+ // /locales/resources.json?lng=de+en&ns=ns1+ns2
+ // Adapter is needed to enable MultiLoading https://github.com/i18next/i18next-multiload-backend-adapter
+ // Returned JSON structure in this case is
+ // {
+ // lang : {
+ // namespaceA: {},
+ // namespaceB: {},
+ // ...etc
+ // }
+ // }
+ allowMultiLoading: false, // set loadPath: '/locales/resources.json?lng={{lng}}&ns={{ns}}' to adapt to multiLoading
+
+ // parse data after it has been fetched
+ // in example use https://www.npmjs.com/package/json5
+ // here it removes the letter a from the json (bad idea)
+ parse: function(data) { return data.replace(/a/g, ''); },
+
+ // allow cross domain requests
+ crossDomain: false,
+
+ // allow credentials on cross domain requests
+ withCredentials: false,
+
+ // define a custom xhr function
+ // can be used to support XDomainRequest in IE 8 and 9
+ //
+ // 'url' will be passed the value of 'loadPath'
+ // 'options' will be this entire options object
+ // 'callback' is a function that takes two parameters, 'data' and 'xhr'.
+ // 'data' should be the key:value translation pairs for the
+ // requested language and namespace, or null in case of an error.
+ // 'xhr' should be a status object, e.g. { status: 200 }
+ // 'data' will be a key:value object used when saving missing translations
+ ajax: function (url, options, callback, data) {},
+
+ // adds parameters to resource URL. 'example.com' -> 'example.com?v=1.3.5'
+ queryStringParams: { v: '1.3.5' }
+}
+```
+
+Options can be passed in:
+
+**preferred** - by setting options.backend in i18next.init:
+
+```js
+import i18next from 'i18next';
+import XHR from 'i18next-xhr-backend';
+
+i18next
+ .use(XHR)
+ .init({
+ backend: options
+ });
+```
+
+on construction:
+
+```js
+ import XHR from 'i18next-xhr-backend';
+ const xhr = new XHR(null, options);
+```
+
+via calling init:
+
+```js
+ import XHR from 'i18next-xhr-backend';
+ const xhr = new XHR();
+ xhr.init(null, options);
+```
+
+## Misc
+
+#### Usage with webpack's bundle loader instead of using xhr requests
+
+To use with webpack, install [bundle-loader](https://github.com/webpack/bundle-loader) and [json-loader](https://github.com/webpack/json-loader).
+
+Define a custom xhr function, webpack's bundle loader will load the translations for you.
+
+```js
+function loadLocales(url, options, callback, data) {
+ try {
+ let waitForLocale = require('bundle!./locales/'+url+'.json');
+ waitForLocale((locale) => {
+ callback(locale, {status: '200'});
+ })
+ } catch (e) {
+ callback(null, {status: '404'});
+ }
+}
+
+i18next
+ .use(XHR)
+ .init({
+ backend: {
+ loadPath: '{{lng}}',
+ parse: (data) => data,
+ ajax: loadLocales
+ }
+ }, (err, t) => {
+ // ...
+ });
+```
+
+#### TypeScript definitions
+
+- Install from `@types` (for TypeScript v2 and later):
+
+ npm install --save-dev @types/i18next-xhr-backend
+
+- Install from `typings`:
+
+ typings install --save --global dt~i18next-xhr-backend
+
+--------------
+
+