Skip to content

Commit e92d1a8

Browse files
Support custom language names in Mobile Web (#2305)
We were using a different library for those translations
1 parent c1caee6 commit e92d1a8

File tree

4 files changed

+4
-9
lines changed

4 files changed

+4
-9
lines changed

assets/js/components/respondents/RespondentRow.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @flow
22
import React, { Component } from "react"
33
import dateformat from "dateformat"
4-
import languageNames from "language-names"
4+
import { codeToName } from "../../language"
55
import capitalize from "lodash/capitalize"
66
import { fieldUniqueKey, isFieldSelected } from "../../reducers/respondents"
77

@@ -65,7 +65,7 @@ class RespondentRow extends Component<Props> {
6565
// For the 'language' variable we convert the code to the native name
6666
let value = response.value
6767
if (response.name == "language") {
68-
value = languageNames[value] || value
68+
value = codeToName(value) || value
6969
}
7070

7171
return (

assets/mobile_survey/js/components/steps/LanguageSelectionStep.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @flow
22
import React, { Component, PropTypes } from "react"
33
import Prompt from "../Prompt"
4-
import languageNames from "language-names"
4+
import { codeToName } from "../../../../js/language"
55

66
type Props = {
77
step: Object,
@@ -33,7 +33,7 @@ class LanguageSelectionStep extends Component<Props> {
3333
onClick(index + 1)
3434
}}
3535
>
36-
{languageNames[choice]}
36+
{codeToName(choice)}
3737
</button>
3838
</div>
3939
)

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"iso-639-3": "^1.0.0",
2020
"jquery": "^3.1.0",
2121
"lamejs": "^1.2.0",
22-
"language-names": "^0.1.0",
2322
"linkifyjs": "^2.1.9",
2423
"materialize-autocomplete": "^1.0.7",
2524
"msr": "^1.3.4",

yarn.lock

-4
Original file line numberDiff line numberDiff line change
@@ -4706,10 +4706,6 @@ lamejs@^1.2.0:
47064706
dependencies:
47074707
use-strict "1.0.1"
47084708

4709-
language-names@^0.1.0:
4710-
version "0.1.0"
4711-
resolved "https://registry.yarnpkg.com/language-names/-/language-names-0.1.0.tgz#82fd6305b73aa0be92d9dd6128e3921a3f5ca5cb"
4712-
47134709
lazy-cache@^1.0.3:
47144710
version "1.0.4"
47154711
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"

0 commit comments

Comments
 (0)