Skip to content

Commit

Permalink
Update i18next
Browse files Browse the repository at this point in the history
Updates to latest i18next client, 7.0.0. Switch to using
`i18next-resource-store-loader` to inline the actual translation files
using Webpack.
  • Loading branch information
outoftime committed Feb 11, 2017
1 parent 045a4a7 commit 1eda41d
Show file tree
Hide file tree
Showing 20 changed files with 37 additions and 60 deletions.
File renamed without changes.
Empty file added locales/index.js
Empty file.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"github-api": "git+https://github.com/michael/github.git#v2.4.0",
"html-inspector": "^0.8.2",
"htmllint": "^0.4.0",
"i18next-client": "^1.10.2",
"i18next": "^7.0.0",
"immutable": "^3.7.5",
"js-cookie": "^2.1.3",
"jshint": "^2.9.3",
Expand Down Expand Up @@ -131,6 +131,7 @@
"gulp-postcss": "^6.1.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-util": "^3.0.7",
"i18next-resource-store-loader": "^0.1.1",
"immutable-devtools": "0.0.7",
"imports-loader": "^0.6.5",
"json-loader": "^0.5.4",
Expand Down
2 changes: 1 addition & 1 deletion src/components/BrowserError.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import i18n from 'i18next-client';
import i18n from 'i18next';

function getBrowserLink(browser) {
if (browser.firefox) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dashboard.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import i18n from 'i18next-client';
import i18n from 'i18next';
import partial from 'lodash/partial';
import classnames from 'classnames';
import ProjectList from './ProjectList';
Expand Down
2 changes: 1 addition & 1 deletion src/components/EditorContainer.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import i18n from 'i18next-client';
import i18n from 'i18next';

function EditorContainer(props) {
let helpText;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ErrorSublist.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import map from 'lodash/map';
import partial from 'lodash/partial';
import i18n from 'i18next-client';
import i18n from 'i18next';
import ErrorItem from './ErrorItem';

function ErrorSublist(props) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Output.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import i18n from 'i18next-client';
import i18n from 'i18next';
import isEmpty from 'lodash/isEmpty';
import ErrorList from './ErrorList';
import Preview from './Preview';
Expand Down
2 changes: 1 addition & 1 deletion src/components/PreviewFrame.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import Bowser from 'bowser';
import bindAll from 'lodash/bindAll';
import i18n from 'i18next-client';
import i18n from 'i18next';
import normalizeError from '../util/normalizeError';
import {sourceDelimiter} from '../util/generatePreview';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Sidebar.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import i18n from 'i18next-client';
import i18n from 'i18next';
import classnames from 'classnames';
import partial from 'lodash/partial';
import WordmarkVertical from '../../static/images/wordmark-vertical.svg';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Workspace.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import sortBy from 'lodash/sortBy';
import map from 'lodash/map';
import isError from 'lodash/isError';
import isString from 'lodash/isString';
import i18n from 'i18next-client';
import i18n from 'i18next';
import qs from 'qs';
import fs from 'fs';
import path from 'path';
Expand Down
2 changes: 1 addition & 1 deletion src/components/notifications/GenericNotification.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import i18n from 'i18next-client';
import i18n from 'i18next';

export default function GenericNotification(props) {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/notifications/GistExportNotification.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import i18n from 'i18next-client';
import i18n from 'i18next';

export default function GistExportNotification(props) {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/notifications/GistImportError.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import i18n from 'i18next-client';
import i18n from 'i18next';

function gistUrlFromId(gistId) {
return `https://gist.github.com/${gistId}`;
Expand Down
2 changes: 1 addition & 1 deletion src/util/arrayToSentence.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'i18next-client';
import i18n from 'i18next';
import arrayToSentence from 'array-to-sentence';

export function localizedArrayToSentence(array) {
Expand Down
18 changes: 4 additions & 14 deletions src/util/initI18n.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import i18n from 'i18next-client';
import i18n from 'i18next';
import resources from '../../locales';

import EN from '../../locales/en.json';

const translations = {
en: {
translation: EN,
},
};

function initI18n() {
export default function() {
i18n.init({
fallbackLng: 'en',
debug: true,
resStore: translations,
resources,
});
}

export default initI18n;
2 changes: 1 addition & 1 deletion src/util/normalizeError.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import get from 'lodash/get';
import keys from 'lodash/keys';
import isEmpty from 'lodash/isEmpty';
import assign from 'lodash/assign';
import i18n from 'i18next-client';
import i18n from 'i18next';

const normalizers = {
Chrome: {
Expand Down
2 changes: 1 addition & 1 deletion src/validations/Validator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'i18next-client';
import i18n from 'i18next';
import assign from 'lodash/assign';
import map from 'lodash/map';
import compact from 'lodash/compact';
Expand Down
5 changes: 5 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ module.exports = {
},
],
},
{
include: path.resolve(__dirname, 'locales'),
loader: 'i18next-resource-store-loader',
query: {include: '\\.json$'},
},
],
},
plugins: [
Expand Down
43 changes: 12 additions & 31 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1882,13 +1882,6 @@ [email protected], [email protected], css@^2.2.1:
postcss-value-parser "^3.2.3"
postcss-zindex "^2.0.1"

csso@~2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/csso/-/csso-2.2.1.tgz#51fbb5347e50e81e6ed51668a48490ae6fe2afe2"
dependencies:
clap "^1.0.9"
source-map "^0.5.3"

csso@~2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/csso/-/csso-2.3.1.tgz#4f8d91a156f2f1c2aebb40b8fb1b5eb83d94d3b9"
Expand Down Expand Up @@ -3646,9 +3639,16 @@ [email protected]:
debug "2"
extend "3"

i18next-client@^1.10.2:
version "1.11.5"
resolved "https://registry.yarnpkg.com/i18next-client/-/i18next-client-1.11.5.tgz#4d3e434929d7855d994296b9593849a1e1f1f7c3"
i18next-resource-store-loader@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/i18next-resource-store-loader/-/i18next-resource-store-loader-0.1.1.tgz#6630ba3a95c10711973b0352c32823a77f3f805f"
dependencies:
loader-utils "^0.2.11"
lodash "^4.6.1"

i18next@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-7.0.0.tgz#8944ec20a31244fe85fa464350f48373efea3103"

[email protected], iconv-lite@^0.4.5, iconv-lite@~0.4.13:
version "0.4.13"
Expand Down Expand Up @@ -4064,13 +4064,6 @@ js-yaml@^3.4.2, js-yaml@^3.4.3, js-yaml@^3.5.1, js-yaml@~3.7.0:
argparse "^1.0.7"
esprima "^2.6.0"

js-yaml@~3.6.1:
version "3.6.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30"
dependencies:
argparse "^1.0.7"
esprima "^2.6.0"

jsbn@~0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.0.tgz#650987da0dd74f4ebf5a11377a2aa2d273e97dfd"
Expand Down Expand Up @@ -4572,7 +4565,7 @@ [email protected]:
version "3.7.0"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.7.0.tgz#3678bd8ab995057c07ade836ed2ef087da811d45"

"[email protected] || ^4.16.1", lodash@^4.0.0, lodash@^4.0.1, lodash@^4.1.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.5.1, lodash@^4.7.0:
"[email protected] || ^4.16.1", lodash@^4.0.0, lodash@^4.0.1, lodash@^4.1.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.5.1, lodash@^4.6.1, lodash@^4.7.0:
version "4.17.2"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42"

Expand Down Expand Up @@ -7185,19 +7178,7 @@ svgo-loader@^1.1.2:
dependencies:
loader-utils "^0.2.16"

svgo@^0.7.0:
version "0.7.1"
resolved "https://registry.yarnpkg.com/svgo/-/svgo-0.7.1.tgz#287320fed972cb097e72c2bb1685f96fe08f8034"
dependencies:
coa "~1.0.1"
colors "~1.1.2"
csso "~2.2.1"
js-yaml "~3.6.1"
mkdirp "~0.5.1"
sax "~1.2.1"
whet.extend "~0.9.9"

svgo@^0.7.2:
svgo@^0.7.0, svgo@^0.7.2:
version "0.7.2"
resolved "https://registry.yarnpkg.com/svgo/-/svgo-0.7.2.tgz#9f5772413952135c6fefbf40afe6a4faa88b4bb5"
dependencies:
Expand Down

0 comments on commit 1eda41d

Please sign in to comment.