aboutsummaryrefslogtreecommitdiff
path: root/src/i18n.tsx
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-29 16:58:03 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-29 16:58:03 +0200
commitb5c90d12219ca3a0df173ddf085d2353831a8ef6 (patch)
treefd26569ccacbed57cb47c24cce7863fb060f42cf /src/i18n.tsx
parent1c3346cd534143f4dd56a625b963a1a3acfa83d1 (diff)
fix remaining lint warnings
Diffstat (limited to 'src/i18n.tsx')
-rw-r--r--src/i18n.tsx41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/i18n.tsx b/src/i18n.tsx
index 8c3d54192..8f2c15443 100644
--- a/src/i18n.tsx
+++ b/src/i18n.tsx
@@ -21,8 +21,9 @@
/**
* Imports.
*/
-import * as jedLib from "jed";
import {strings} from "./i18n/strings";
+
+import * as jedLib from "jed";
import * as React from "react";
let lang: string;
@@ -111,15 +112,15 @@ interface TranslateProps {
* </Translate>
* ```
*/
-export class Translate extends React.Component<TranslateProps,void> {
+export class Translate extends React.Component<TranslateProps, void> {
render(): JSX.Element {
const s = stringifyChildren(this.props.children);
- const tr = jed.ngettext(s, s, 1).split(/%(\d+)\$s/).filter((e: any, i: number) => i % 2 == 0);
+ const tr = jed.ngettext(s, s, 1).split(/%(\d+)\$s/).filter((e: any, i: number) => i % 2 === 0);
const childArray = React.Children.toArray(this.props.children!);
for (let i = 0; i < childArray.length - 1; ++i) {
- if ((typeof childArray[i]) == "string" && (typeof childArray[i+1]) == "string") {
- childArray[i+1] = (childArray[i] as string).concat(childArray[i+1] as string);
- childArray.splice(i,1);
+ if ((typeof childArray[i]) === "string" && (typeof childArray[i + 1]) === "string") {
+ childArray[i + 1] = (childArray[i] as string).concat(childArray[i + 1] as string);
+ childArray.splice(i, 1);
}
}
const result = [];
@@ -155,20 +156,20 @@ export class Translate extends React.Component<TranslateProps,void> {
* </TranslateSwitch>
* ```
*/
-export class TranslateSwitch extends React.Component<TranslateSwitchProps,void>{
+export class TranslateSwitch extends React.Component<TranslateSwitchProps, void> {
render(): JSX.Element {
let singular: React.ReactElement<TranslationPluralProps> | undefined;
let plural: React.ReactElement<TranslationPluralProps> | undefined;
const children = this.props.children;
if (children) {
React.Children.forEach(children, (child: any) => {
- if (child.type == TranslatePlural) {
+ if (child.type === TranslatePlural) {
plural = child;
}
- if (child.type == TranslateSingular) {
+ if (child.type === TranslateSingular) {
singular = child;
}
- });
+ });
}
if ((!singular) || (!plural)) {
console.error("translation not found");
@@ -190,15 +191,15 @@ interface TranslationPluralProps {
/**
* See [[TranslateSwitch]].
*/
-export class TranslatePlural extends React.Component<TranslationPluralProps,void> {
+export class TranslatePlural extends React.Component<TranslationPluralProps, void> {
render(): JSX.Element {
const s = stringifyChildren(this.props.children);
- const tr = jed.ngettext(s, s, 1).split(/%(\d+)\$s/).filter((e: any, i: number) => i % 2 == 0);
+ const tr = jed.ngettext(s, s, 1).split(/%(\d+)\$s/).filter((e: any, i: number) => i % 2 === 0);
const childArray = React.Children.toArray(this.props.children!);
for (let i = 0; i < childArray.length - 1; ++i) {
- if ((typeof childArray[i]) == "string" && (typeof childArray[i + 1]) == "string") {
- childArray[i+i] = childArray[i] as string + childArray[i + 1] as string;
- childArray.splice(i,1);
+ if ((typeof childArray[i]) === "string" && (typeof childArray[i + 1]) === "string") {
+ childArray[i + i] = childArray[i] as string + childArray[i + 1] as string;
+ childArray.splice(i, 1);
}
}
const result = [];
@@ -222,15 +223,15 @@ export class TranslatePlural extends React.Component<TranslationPluralProps,void
/**
* See [[TranslateSwitch]].
*/
-export class TranslateSingular extends React.Component<TranslationPluralProps,void> {
+export class TranslateSingular extends React.Component<TranslationPluralProps, void> {
render(): JSX.Element {
const s = stringifyChildren(this.props.children);
- const tr = jed.ngettext(s, s, 1).split(/%(\d+)\$s/).filter((e: any, i: number) => i % 2 == 0);
+ const tr = jed.ngettext(s, s, 1).split(/%(\d+)\$s/).filter((e: any, i: number) => i % 2 === 0);
const childArray = React.Children.toArray(this.props.children!);
for (let i = 0; i < childArray.length - 1; ++i) {
- if ((typeof childArray[i]) == "string" && (typeof childArray[i + 1]) == "string") {
- childArray[i+i] = childArray[i] as string + childArray[i + 1] as string;
- childArray.splice(i,1);
+ if ((typeof childArray[i]) === "string" && (typeof childArray[i + 1]) === "string") {
+ childArray[i + i] = childArray[i] as string + childArray[i + 1] as string;
+ childArray.splice(i, 1);
}
}
const result = [];