Skip to content

Commit

Permalink
Support custom language names in Mobile Web (#2305)
Browse files Browse the repository at this point in the history
We were using a different library for those translations
  • Loading branch information
matiasgarciaisaia authored Oct 25, 2023
1 parent 10a0729 commit 0c39353
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions assets/js/components/respondents/RespondentRow.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import React, { Component } from "react"
import dateformat from "dateformat"
import languageNames from "language-names"
import { codeToName } from "../../language"
import capitalize from "lodash/capitalize"
import { fieldUniqueKey, isFieldSelected } from "../../reducers/respondents"

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

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import React, { Component, PropTypes } from "react"
import Prompt from "../Prompt"
import languageNames from "language-names"
import { codeToName } from "../../../../js/language"

type Props = {
step: Object,
Expand Down Expand Up @@ -33,7 +33,7 @@ class LanguageSelectionStep extends Component<Props> {
onClick(index + 1)
}}
>
{languageNames[choice]}
{codeToName(choice)}
</button>
</div>
)
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"iso-639-3": "^1.0.0",
"jquery": "^3.1.0",
"lamejs": "^1.2.0",
"language-names": "^0.1.0",
"linkifyjs": "^2.1.9",
"materialize-autocomplete": "^1.0.7",
"msr": "^1.3.4",
Expand Down
4 changes: 0 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4706,10 +4706,6 @@ lamejs@^1.2.0:
dependencies:
use-strict "1.0.1"

language-names@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/language-names/-/language-names-0.1.0.tgz#82fd6305b73aa0be92d9dd6128e3921a3f5ca5cb"

lazy-cache@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"
Expand Down

0 comments on commit 0c39353

Please sign in to comment.