Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-jams
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-jams
Commits
05067394
Commit
05067394
authored
4 years ago
by
Larbi Gharib
Browse files
Options
Downloads
Patches
Plain Diff
Threshold language one percent
Change-Id: Ia1f203bcb98f6139ba843b9e3222f646abd1e3e7
parent
7cbfcd6e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jams-react-client/src/components/LanguagePicker/LanguagePicker.js
+13
-59
13 additions, 59 deletions
...ct-client/src/components/LanguagePicker/LanguagePicker.js
with
13 additions
and
59 deletions
jams-react-client/src/components/LanguagePicker/LanguagePicker.js
+
13
−
59
View file @
05067394
...
...
@@ -13,63 +13,6 @@ import i18next from "i18next";
import
{
useTranslation
}
from
"
react-i18next
"
;
// const languages = [
// {
// value: "sq_AL",
// label: "Albanian",
// },
// {
// value: "ar",
// label: "Arabic",
// },
// {
// value: "zh_TW",
// label: "Chinese (Taiwan)",
// },
// {
// value: "en",
// label: "English",
// },
// {
// value: "es",
// label: "Español",
// },
// {
// value: "fi",
// label: "Finnish",
// },
// {
// value: "fr",
// label: "Francais",
// },
// {
// value: "he",
// label: "Hebrew",
// },
// {
// value: "hu",
// label: "Hungarian",
// },
// {
// value: "ja",
// label: "Japanese",
// },
// {
// value: "oc",
// label: "Occitan",
// },
// {
// value: "pt_BR",
// label: "Portuguese",
// },
// {
// value: "ro_RO",
// label: "Romanian",
// },
// ];
const
useStyles
=
makeStyles
((
theme
)
=>
({
root
:
{
"
& .MuiTextField-root
"
:
{
...
...
@@ -83,13 +26,24 @@ const useStyles = makeStyles((theme) => ({
export
default
function
LanguagePicker
(
props
)
{
const
history
=
useHistory
();
const
[
language
,
setLanguage
]
=
React
.
useState
(
i18next
.
language
||
window
.
localStorage
.
i18nextLng
||
"
en
"
);
const
[
languages
,
setLanguages
]
=
React
.
useState
([]);
const
[
languages
,
setLanguages
]
=
React
.
useState
([
{
"
code
"
:
"
en
"
,
"
name
"
:
"
English
"
}
]);
const
{
i18n
}
=
useTranslation
();
useEffect
(()
=>
{
fetch
(
"
/available_languages.json
"
).
then
(
res
=>
res
.
json
()).
then
((
result
)
=>
{
setLanguages
(
result
.
languages
)
const
response
=
result
.
languages
;
let
translates_languages
=
[];
response
.
forEach
((
lang
)
=>
{
if
(
result
.
stats
[
lang
.
code
][
"
translated
"
][
"
percentage
"
]
>
0.01
){
console
.
log
(
lang
);
translates_languages
.
push
(
lang
);
}
})
setLanguages
(
translates_languages
)
})
},
[
language
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment