dep updates (fe)
parent
011e900aee
commit
c7d44453aa
|
@ -1,7 +1,7 @@
|
|||
import { detectLanguage } from "../i18n";
|
||||
import { attachToRoot } from "../util";
|
||||
import { stopIE } from "../util/stop_ie";
|
||||
import I from "i18next";
|
||||
import I, { InitOptions } from "i18next";
|
||||
import { DemoIframe } from "./demo_iframe";
|
||||
|
||||
// ENTRY POINT FOR WEB APP DEMO IFRAME ===========
|
||||
|
@ -10,6 +10,6 @@ stopIE();
|
|||
|
||||
const doAttach = () => attachToRoot(DemoIframe);
|
||||
const loadDemo =
|
||||
(config: I.InitOptions) => I.init(config, doAttach);
|
||||
(config: InitOptions) => I.init(config, doAttach);
|
||||
|
||||
detectLanguage().then(loadDemo);
|
||||
|
|
|
@ -19,7 +19,7 @@ interface Window {
|
|||
}
|
||||
|
||||
declare namespace jest {
|
||||
export interface Matchers<R> {
|
||||
export interface Matchers<R, T> {
|
||||
toBeSameTimeAs: jest.Expect;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import axios from "axios";
|
||||
import I from "i18next";
|
||||
import { InitOptions } from "i18next";
|
||||
import { merge } from "lodash";
|
||||
|
||||
const translationFilePath = (lang: string): string =>
|
||||
|
@ -26,7 +26,7 @@ type Translations = { [key: string]: string };
|
|||
const parseTranslationData = (data: TranslationFile): Translations =>
|
||||
merge(data["translated"], data["untranslated"], data["other_translations"]);
|
||||
|
||||
export function generateI18nConfig(lang: string): Promise<I.InitOptions> {
|
||||
export function generateI18nConfig(lang: string): Promise<InitOptions> {
|
||||
return axios
|
||||
.get<TranslationFile>(translationFilePath(lang))
|
||||
.then(response => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import I from "i18next";
|
||||
import { Callback } from "i18next";
|
||||
import _React, { createElement } from "react";
|
||||
import { render } from "react-dom";
|
||||
import { PasswordReset } from "./password_reset";
|
||||
|
@ -6,7 +6,7 @@ import { bail } from "../util";
|
|||
|
||||
export const MISSING_DIV = "Add a div with id `root` to the page first.";
|
||||
|
||||
export const onInit: I.Callback = async () => {
|
||||
export const onInit: Callback = async () => {
|
||||
const node = document.createElement("DIV");
|
||||
node.id = "root";
|
||||
document.body.appendChild(node);
|
||||
|
|
14
package.json
14
package.json
|
@ -29,15 +29,15 @@
|
|||
"@blueprintjs/datetime": "3.14.0",
|
||||
"@blueprintjs/select": "3.11.1",
|
||||
"@types/enzyme": "3.10.3",
|
||||
"@types/jest": "24.0.19",
|
||||
"@types/jest": "24.0.21",
|
||||
"@types/lodash": "4.14.144",
|
||||
"@types/markdown-it": "0.0.9",
|
||||
"@types/moxios": "0.4.9",
|
||||
"@types/node": "12.11.5",
|
||||
"@types/node": "12.12.3",
|
||||
"@types/promise-timeout": "1.3.0",
|
||||
"@types/react": "16.9.9",
|
||||
"@types/react": "16.9.11",
|
||||
"@types/react-color": "3.0.1",
|
||||
"@types/react-dom": "16.9.2",
|
||||
"@types/react-dom": "16.9.3",
|
||||
"@types/react-redux": "7.1.5",
|
||||
"axios": "0.19.0",
|
||||
"boxed_value": "1.0.0",
|
||||
|
@ -46,7 +46,7 @@
|
|||
"enzyme": "3.10.0",
|
||||
"enzyme-adapter-react-16": "1.15.1",
|
||||
"farmbot": "8.3.0-rc6",
|
||||
"i18next": "17.3.0",
|
||||
"i18next": "19.0.0",
|
||||
"install": "0.13.0",
|
||||
"lodash": "4.17.15",
|
||||
"markdown-it": "10.0.0",
|
||||
|
@ -54,7 +54,7 @@
|
|||
"moment": "2.24.0",
|
||||
"moxios": "0.4.0",
|
||||
"mqtt": "3.0.0",
|
||||
"npm": "6.12.0",
|
||||
"npm": "6.12.1",
|
||||
"parcel-bundler": "1.12.4",
|
||||
"promise-timeout": "1.3.0",
|
||||
"raf": "3.4.1",
|
||||
|
@ -83,7 +83,7 @@
|
|||
"jest-cli": "24.9.0",
|
||||
"jest-skipped-reporter": "0.0.4",
|
||||
"jshint": "2.10.2",
|
||||
"madge": "3.4.4"
|
||||
"madge": "3.5.0"
|
||||
},
|
||||
"jest": {
|
||||
"clearMocks": true,
|
||||
|
|
|
@ -96,13 +96,25 @@ var HelperNamespace = (function () {
|
|||
console.dir(getAllTags());
|
||||
}
|
||||
|
||||
/** For debugging. Replace all characters except whitespace and {{ words }} */
|
||||
function repl(string, character) {
|
||||
var parts = string.split("{{");
|
||||
if (parts.length < 2) { return string.replace(/\S/g, character); }
|
||||
var insideAndAfter = parts[1].split("}}");
|
||||
var before = parts[0].replace(/\S/g, character);
|
||||
var inside = insideAndAfter[0];
|
||||
var after = insideAndAfter[1].replace(/\S/g, character);
|
||||
var firstPart = [before, inside].join("{{");
|
||||
return [firstPart, after].join("}}");
|
||||
}
|
||||
|
||||
/** For debugging. Replace all translations with a debug string. */
|
||||
function replaceWithDebugString(key, debugString, debugStringOption) {
|
||||
var debugChar = debugString[0];
|
||||
switch (debugStringOption) {
|
||||
case 'r': return debugString; // replace with: string as provided
|
||||
case 's': return debugChar; // single character
|
||||
case 'n': return key.replace(/\S/g, debugChar); // maintain whitespace
|
||||
case 'n': return repl(key, debugChar); // maintain whitespace
|
||||
case 'l': return debugChar.repeat(key.length); // replace whitespace
|
||||
default: return key;
|
||||
}
|
||||
|
|
|
@ -18,21 +18,20 @@ npm run translation-check
|
|||
|
||||
See the [README](https://github.com/FarmBot/Farmbot-Web-App#translating-the-web-app-into-your-language) for contribution instructions.
|
||||
|
||||
Total number of phrases identified by the language helper for translation: __1101__
|
||||
Total number of phrases identified by the language helper for translation: __1114__
|
||||
|
||||
|Language|Percent translated|Translated|Untranslated|Other Translations|
|
||||
|:---:|---:|---:|---:|---:|
|
||||
|af|100%|1101|0|1|
|
||||
|da|10%|110|991|31|
|
||||
|de|38%|420|681|128|
|
||||
|es|92%|1015|86|160|
|
||||
|fr|69%|762|339|186|
|
||||
|it|8%|89|1012|178|
|
||||
|nl|7%|79|1022|148|
|
||||
|pt|6%|71|1030|167|
|
||||
|ru|55%|604|497|208|
|
||||
|th|0%|0|1101|0|
|
||||
|zh|8%|86|1015|148|
|
||||
|da|10%|110|1004|34|
|
||||
|de|38%|418|696|131|
|
||||
|es|91%|1012|102|163|
|
||||
|fr|68%|759|355|188|
|
||||
|it|8%|90|1024|180|
|
||||
|nl|7%|79|1035|151|
|
||||
|pt|6%|71|1043|170|
|
||||
|ru|54%|601|513|211|
|
||||
|th|0%|0|1114|0|
|
||||
|zh|8%|86|1028|151|
|
||||
|
||||
**Percent translated** refers to the percent of phrases identified by the
|
||||
language helper that have been translated. Additional phrases not identified
|
||||
|
|
Loading…
Reference in New Issue