@@ -13,17 +13,12 @@ import Import from "./Import";
1313import { TranslationDashboard } from "./TranslationDashboard" ;
1414import Button from "@material-ui/core/Button" ;
1515import Box from "@material-ui/core/Box" ;
16+ import Checkbox from "@material-ui/core/Checkbox" ;
17+ import FormControlLabel from "@material-ui/core/FormControlLabel" ;
1618import { DocumentationContainer } from "../common/components/DocumentationContainer" ;
1719
1820const EMPTY_TRANSLATION_KEY = "KEY_NOT_DEFINED" ;
19- export const Translations = ( {
20- user,
21- organisationConfig,
22- getOrgConfig,
23- dashboardData,
24- getDashboardData,
25- history
26- } ) => {
21+ export const Translations = ( { user, organisationConfig, getOrgConfig, dashboardData, getDashboardData, history } ) => {
2722 useEffect ( ( ) => {
2823 getOrgConfig ( ) ;
2924 getDashboardData ( "Android" , EMPTY_TRANSLATION_KEY ) ;
@@ -32,17 +27,16 @@ export const Translations = ({
3227 const platforms = [ { id : "Android" , name : "Android" } , { id : "Web" , name : "Web" } ] ;
3328 const localeChoices = organisationConfig && getLocales ( organisationConfig ) ;
3429 const [ platform , setPlatform ] = useState ( "" ) ;
30+ const [ excludeLocations , setExcludeLocations ] = useState ( false ) ;
3531
3632 const onDownloadPressedHandler = ( ) => {
3733 const platformId = find ( platforms , p => p . name === platform ) . id ;
3834 return http
39- . get ( http . withParams ( "/translation" , { platform : platformId } ) )
35+ . get ( http . withParams ( "/translation" , { platform : platformId , includeLocations : ! excludeLocations } ) )
4036 . then ( response => {
4137 const zip = new JSZip ( ) ;
4238 const folder = zip . folder ( "locale" ) ;
43- response . data . forEach ( data =>
44- folder . file ( data . language + ".json" , JSON . stringify ( data . translationJson , undefined , 2 ) )
45- ) ;
39+ response . data . forEach ( data => folder . file ( data . language + ".json" , JSON . stringify ( data . translationJson , undefined , 2 ) ) ) ;
4640 zip . generateAsync ( { type : "blob" } ) . then ( content => saveAs ( content , "translations.zip" ) ) ;
4741 } )
4842 . catch ( error => {
@@ -64,11 +58,7 @@ export const Translations = ({
6458 </ span >
6559 ) ;
6660 return (
67- < ScreenWithAppBar
68- appbarTitle = { `Translations` }
69- enableLeftMenuButton = { true }
70- renderAllOptions = { false }
71- >
61+ < ScreenWithAppBar appbarTitle = { `Translations` } enableLeftMenuButton = { true } renderAllOptions = { false } >
7262 < Box > Language not set { link } to set.</ Box >
7363 </ ScreenWithAppBar >
7464 ) ;
@@ -79,21 +69,15 @@ export const Translations = ({
7969 < DocumentationContainer filename = { "Translation.md" } >
8070 < div id = { "margin" } >
8171 < Box border = { 1 } borderColor = { "#ddd" } p = { 2 } >
82- < TranslationDashboard
83- data = { dashboardData }
84- emptyTranslationKey = { EMPTY_TRANSLATION_KEY }
85- />
72+ < TranslationDashboard data = { dashboardData } emptyTranslationKey = { EMPTY_TRANSLATION_KEY } />
8673 </ Box >
8774 < p />
8875 < Box border = { 1 } borderColor = { "#ddd" } p = { 2 } >
8976 < Grid >
9077 < h5 id = "title" > Upload Translations</ h5 >
9178 </ Grid >
9279 < Grid container direction = "row" justify = "flex-start" alignItems = "center" >
93- < Import
94- locales = { localeChoices }
95- onSuccessfulImport = { ( ) => getDashboardData ( "Android" , EMPTY_TRANSLATION_KEY ) }
96- />
80+ < Import locales = { localeChoices } onSuccessfulImport = { ( ) => getDashboardData ( "Android" , EMPTY_TRANSLATION_KEY ) } />
9781 </ Grid >
9882 </ Box >
9983 < p />
@@ -102,12 +86,13 @@ export const Translations = ({
10286 < h5 id = "title" > Download Translations</ h5 >
10387 </ Grid >
10488 < Grid container direction = "row" justify = "flex-start" alignItems = "center" m = { 3 } >
105- < DropDown
106- name = "Platform"
107- value = { platform }
108- onChange = { setPlatform }
109- options = { platforms }
110- />
89+ < DropDown name = "Platform" value = { platform } onChange = { setPlatform } style = { { width : 120 } } options = { platforms } />
90+ < Box pl = { 2 } >
91+ < FormControlLabel
92+ control = { < Checkbox checked = { excludeLocations } onChange = { ( ) => setExcludeLocations ( prev => ! prev ) } color = "primary" /> }
93+ label = "Exclude Locations"
94+ />
95+ </ Box >
11196 < Box pl = { 2 } pr = { 4 } >
11297 < Button
11398 variant = "contained"
0 commit comments