From 2cd2e792379a7cf9a1e980e6e18821bae0300199 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 10 Jun 2018 21:43:40 +0900 Subject: [PATCH] Making LOCALIZATION --- app/actions/user.js | 18 ++++- app/component/correct.js | 10 +-- app/component/question.js | 6 -- app/config/localization.js | 76 ++++++++++++------ app/config/router.js | 4 +- app/index.js | 2 +- app/lib/constants.js | 1 + app/reducers/user.js | 7 +- app/screens/Learn/HL2.js | 4 - app/screens/Learn/LearnList.js | 4 - app/screens/Learn/LearnModule.js | 4 - app/screens/Learn/SL2.js | 4 - app/screens/Login/login.js | 5 -- app/screens/Login/login_new..js | 5 -- app/screens/Profile/profile.js | 120 ++++++++++++++++++++++++++-- app/screens/Quiz/quizBeforeList.js | 5 -- app/screens/Quiz/quizFlash.js | 4 - app/screens/Quiz/quizMain.js | 4 - app/screens/Setting/mainsetting.js | 2 +- app/screens/Study/hiraganaList.js | 16 ++-- app/screens/Study/studyList.js | 17 ++-- app/screens/Summary/studyPick.js | 4 - app/screens/Summary/summaryLearn.js | 4 - app/screens/home.js | 28 ++++--- app/screens/sketch.js | 12 ++- app/styles/profileStyle.js | 62 ++++++++++++++ 26 files changed, 302 insertions(+), 126 deletions(-) diff --git a/app/actions/user.js b/app/actions/user.js index 610a7d7..fa9c000 100644 --- a/app/actions/user.js +++ b/app/actions/user.js @@ -1,4 +1,4 @@ -import {FETCH_USER , FETCH_USER_SUCCESS , FETCH_USER_FAILED, USER_REMOVE} from '../lib/constants'; +import {FETCH_USER , FETCH_USER_SUCCESS , FETCH_USER_FAILED, USER_REMOVE , LOCALIZATION} from '../lib/constants'; import { USER_LOGIN_SUCCESS, USER_LOGIN_FAILED, USER_UPDATE_SUCCESS} from '../lib/constants'; import { AsyncStorage } from 'react-native'; @@ -87,6 +87,13 @@ export function deleteUserState(){ }; } +export function localization(Value){ + return (dispatch) => { + dispatch(localizationDispatch(Value)) + }; +} + + export function updateProfile(userVal){ return (dispatch) => { console.log('run'); @@ -202,4 +209,11 @@ export function userLoginFailed(error){ type: USER_LOGIN_FAILED, error: error, } -} \ No newline at end of file +} + +export function localizationDispatch(value){ + return{ + type: LOCALIZATION, + data: value, + } +} diff --git a/app/component/correct.js b/app/component/correct.js index 3fa8afd..ce9c12c 100644 --- a/app/component/correct.js +++ b/app/component/correct.js @@ -24,17 +24,9 @@ class CorrectPanel extends Component { constructor(props) { super(props); - - this._onSetLanguageTo('en'); - this.currentAudio = this.props.question.id; - + this.currentAudio = this.props.question.id; this.imageSource = this.props.img ? ( ImageData[this.props.img] ) : ImageData.default_bg; } - - _onSetLanguageTo(value) { - strings.setLanguage(value); - } - componentWillMount() { this.loadAudio(); diff --git a/app/component/question.js b/app/component/question.js index 3c49bd6..1b750b8 100644 --- a/app/component/question.js +++ b/app/component/question.js @@ -25,17 +25,11 @@ class QuestionPanel extends Component { constructor(props) { super(props); - - this._onSetLanguageTo('en'); this.currentAudio = this.props.question.id; this.imageSource = this.props.img ? ( ImageData[this.props.img] ) : ImageData.default_bg; } - _onSetLanguageTo(value) { - strings.setLanguage(value); - } - componentWillMount() { if(this.props.format == 'audio'){ this.loadAudio(); diff --git a/app/config/localization.js b/app/config/localization.js index 6af50f2..0245b29 100644 --- a/app/config/localization.js +++ b/app/config/localization.js @@ -69,7 +69,22 @@ export let strings = new LocalizedStrings({ FUKUSHU2_TITLE : "FUKUSHU TEST", FUKUSHU3_TITLE : "FUKUSHU TEST", FUKUSHU4_TITLE : "FUKUSHU TEST", - }, + SETTING_LANGUAGES : "APLICCATION LANGUAGES", + SETTING_LANGUAGES_PROFILE : "LANGUAGES SETTINGS", + HOME_STUDY : "STUDY", + HOME_SUMMARY : "SUMMARY", + HOME_PROFILE : "PROFILE", + HOME_TARGET : "Target Date", + HOME_LEFT : "d Left", + HOME_MESSAGE : "Hello! How are you\nLet's Study", + STUDY_LEARN : "LEARN", + STUDY_QUIZ : "QUIZ", + STUDY_TEST : "TEST", + STUDY_START : "START", + STUDY_REVIEW : "REVIEW", + PROFILE_MODAL_CLOSE : "CANCEL", + + }, ja: { loginGuest: "japan", vocabulary : "語彙", @@ -103,15 +118,15 @@ export let strings = new LocalizedStrings({ QUESTION_ARRANGE : "Arrange the sentence", // Quiz TIMES_UP: "時間です", - WORD_LIST: "WORD LIST", - EXPLANATION: "EXPLANATION", - FLASH_CARD: "FLASH CARD", - DRAW: "DRAW", - GOI_LIST : "VOCABULARY LIST", - BUNPO_LIST : "GRAMMAR LIST", - KANJI_LIST : "KANJI LIST", - FLASH_CARD_HIRAGANA: "FLASH CARD HIRAGANA", - FLASH_CARD_KATAKANA: "FLASH CARD KATAKANA", + WORD_LIST: "言葉一覧", + EXPLANATION: "説明", + FLASH_CARD: "フラッシュカード", + DRAW: "ドロー", + GOI_LIST : "語彙一覧", + BUNPO_LIST : "文法一覧", + KANJI_LIST : "漢字一覧", + FLASH_CARD_HIRAGANA: "フラッシュカードひらがな", + FLASH_CARD_KATAKANA: "フラッシュカードカタカナ", HIKA_ROMA: "Hiragana/Katakana to Romaji", ROMA_HIKA: "Romaji to Hiragana/Katakana", LISTEN: "Listening", @@ -121,19 +136,34 @@ export let strings = new LocalizedStrings({ REARRANGE: "Rearrange the sentence", ENGLISH: "英語", NEXT:'次', - WORD_LIST_LEARN: "WORD LIST", - EXPLANATION_LEARN: "EXPLANATION", - FLASH_CARD_LEARN: "FLASH CARD", - DRAW_LEARN: "DRAW", - GOI_LIST_LEARN : "VOCABULARY LIST", - BUNPO_LIST_LEARN : "GRAMMAR LIST", - KANJI_LIST_LEARN : "KANJI LIST", - FLASH_CARD_HIRAGANA_LEARN: "FLASH CARD HIRAGANA", - FLASH_CARD_KATAKANA_LEARN: "FLASH CARD KATAKANA", - FUKUSHU1_TITLE : "FUKUSHU TEST", - FUKUSHU2_TITLE : "FUKUSHU TEST", - FUKUSHU3_TITLE : "FUKUSHU TEST", - FUKUSHU4_TITLE : "FUKUSHU TEST", + WORD_LIST_LEARN: "言葉一覧", + EXPLANATION_LEARN: "説明", + FLASH_CARD_LEARN: "フラッシュカード", + DRAW_LEARN: "ドロー", + GOI_LIST_LEARN : "語彙一覧", + BUNPO_LIST_LEARN : "文法一覧", + KANJI_LIST_LEARN : "漢字一覧", + FLASH_CARD_HIRAGANA_LEARN: "フラッシュカードひらがな", + FLASH_CARD_KATAKANA_LEARN: "フラッシュカードカタカナ", + FUKUSHU1_TITLE : "復習テスト", + FUKUSHU2_TITLE : "復習テスト", + FUKUSHU3_TITLE : "復習テスト", + FUKUSHU4_TITLE : "復習テスト", + SETTING_LANGUAGES : "アプリの語", + SETTING_LANGUAGES_PROFILE : "語の設定", + HOME_STUDY : "勉強", + HOME_SUMMARY : "概要", + HOME_PROFILE : "プロフィール", + HOME_TARGET : "制限時間", + HOME_LEFT : "日残り", + HOME_MESSAGE : "こんにちは!お元気ですか?\n勉強しましょう!", + STUDY_LEARN : "学ぶ", + STUDY_QUIZ : "クイズ", + STUDY_TEST : "テスト", + STUDY_START : "スタート", + STUDY_REVIEW : "レビュー", + PROFILE_MODAL_CLOSE : "キャンセル", + } }); \ No newline at end of file diff --git a/app/config/router.js b/app/config/router.js index 9409998..64fd20a 100644 --- a/app/config/router.js +++ b/app/config/router.js @@ -46,6 +46,7 @@ import KatakanaLearnScreen from '../screens/Learn/katakanalearn'; import SummaryTopicList from '../screens/Summary/studyPick'; import SummaryLearnDetail from '../screens/Summary/summaryLearn'; import reviewScreen from '../screens/Summary/reviewSummary'; +import mainSettings from '../screens/Setting/mainsetting'; const styles = require('../styles/style'); @@ -95,7 +96,8 @@ const SettingStack = StackNavigator({ }); const ProfileStack = StackNavigator({ - ProfileMain: ProfileScreen + ProfileMain: ProfileScreen, + MainSettingScreen : mainSettings }); // const QuizHiraganaListStack = StackNavigator({ // QuizHiraganaList: QuizHiraganaListScreen diff --git a/app/index.js b/app/index.js index 449039f..aa3f1bf 100644 --- a/app/index.js +++ b/app/index.js @@ -38,7 +38,7 @@ const Root = SwitchNavigator( class App extends Component { render() { return ( - // + // diff --git a/app/lib/constants.js b/app/lib/constants.js index 2e5a1ac..3956634 100644 --- a/app/lib/constants.js +++ b/app/lib/constants.js @@ -16,6 +16,7 @@ export const TAKE_QUIZ = 'TAKE_QUIZ'; //import the action for start time export const USER_LOGIN_SUCCESS = "USER_LOGIN_SUCCESS"; export const USER_LOGIN_FAILED = " USER_LOGIN_FAILED"; export const USER_UPDATE_SUCCESS = "USER_UPDATE_SUCCESS"; +export const LOCALIZATION = "LOCALIZATION"; //summary export const SUMMARY_HOME = 'SUMMARY_HOME'; //import the action for start time export const SUMMARY_TEST = 'SUMMARY_TEST'; //import the action for Summary Test diff --git a/app/reducers/user.js b/app/reducers/user.js index dc4ca56..a466754 100644 --- a/app/reducers/user.js +++ b/app/reducers/user.js @@ -1,4 +1,4 @@ -import {DATA_AVAILABLE ,FETCH_USER , FETCH_USER_SUCCESS , FETCH_USER_FAILED , USER_REMOVE} from '../lib/constants'; +import {DATA_AVAILABLE ,FETCH_USER , FETCH_USER_SUCCESS , FETCH_USER_FAILED , USER_REMOVE, LOCALIZATION} from '../lib/constants'; import{USER_LOGIN_SUCCESS, USER_LOGIN_FAILED, USER_UPDATE_SUCCESS} from '../lib/constants'; @@ -66,6 +66,11 @@ export default function userReducer (state = initialState, action) { user: action.data, }); return state; + case LOCALIZATION: + state = Object.assign({}, state, { + lang: action.data, + }); + return state; default: return state; } diff --git a/app/screens/Learn/HL2.js b/app/screens/Learn/HL2.js index 61e9732..5ebcd96 100644 --- a/app/screens/Learn/HL2.js +++ b/app/screens/Learn/HL2.js @@ -19,11 +19,7 @@ import ImageData from '../../config/image_list'; class HL2Screen extends Component { constructor() { super(); - this._onSetLanguageTo('en'); } - _onSetLanguageTo(value) { - strings.setLanguage(value); - } static navigationOptions = { title: 'Learn', }; diff --git a/app/screens/Learn/LearnList.js b/app/screens/Learn/LearnList.js index 7b29c67..86c73fb 100644 --- a/app/screens/Learn/LearnList.js +++ b/app/screens/Learn/LearnList.js @@ -19,11 +19,7 @@ import style from 'react-native-datepicker/style'; class LearnListScreen extends Component { constructor() { super(); - this._onSetLanguageTo('en'); } - _onSetLanguageTo(value) { - strings.setLanguage(value); - } static navigationOptions = { title: 'Learn', }; diff --git a/app/screens/Learn/LearnModule.js b/app/screens/Learn/LearnModule.js index 0e0fca6..c5bc41a 100644 --- a/app/screens/Learn/LearnModule.js +++ b/app/screens/Learn/LearnModule.js @@ -32,11 +32,7 @@ import LearnGBK01Screen from '../Learn/LearnGBK01'; class LearnHiraganaModule extends Component { constructor(props) { super(props); - this._onSetLanguageTo('en'); } - _onSetLanguageTo(value) { - strings.setLanguage(value); - } static navigationOptions = { title: 'Learn', swipeEnabled: false diff --git a/app/screens/Learn/SL2.js b/app/screens/Learn/SL2.js index 8fdc739..7dd1b90 100644 --- a/app/screens/Learn/SL2.js +++ b/app/screens/Learn/SL2.js @@ -19,11 +19,7 @@ import ImageData from '../../config/image_list'; class SL2Screen extends Component { constructor() { super(); - this._onSetLanguageTo('en'); } - _onSetLanguageTo(value) { - strings.setLanguage(value); - } static navigationOptions = { title: 'Learn', }; diff --git a/app/screens/Login/login.js b/app/screens/Login/login.js index f25c5d4..8a8fee7 100644 --- a/app/screens/Login/login.js +++ b/app/screens/Login/login.js @@ -24,11 +24,6 @@ import { class LoginScreen extends Component { constructor() { super(); - this._onSetLanguageTo('en'); - } - _onSetLanguageTo(value) { - strings.setLanguage(value); - //this.setState({}); } static navigationOptions = { header: null, diff --git a/app/screens/Login/login_new..js b/app/screens/Login/login_new..js index 12dffff..45ddcc9 100644 --- a/app/screens/Login/login_new..js +++ b/app/screens/Login/login_new..js @@ -29,11 +29,6 @@ import { Username: '', Password: '', }; - this._onSetLanguageTo('en'); - } - _onSetLanguageTo(value) { - strings.setLanguage(value); - //this.setState({}); } static navigationOptions = { header: null, diff --git a/app/screens/Profile/profile.js b/app/screens/Profile/profile.js index 21f128c..bcdcb99 100644 --- a/app/screens/Profile/profile.js +++ b/app/screens/Profile/profile.js @@ -11,9 +11,12 @@ import { Image, ScrollView, TextInput, + Modal, TouchableOpacity, } from 'react-native'; + import LocalizedString from "react-native-localization"; import { List, ListItem } from 'react-native-elements'; +import { NavigationActions } from 'react-navigation'; import PhotoUpload from 'react-native-photo-upload' import { bindActionCreators } from 'redux'; @@ -22,6 +25,7 @@ import * as Actions from '../../actions/user'; //Import your actions import FBLoginView from '../../component/fblogin'; import { FBLogin, FBLoginManager } from 'react-native-facebook-login'; import DatePicker from 'react-native-datepicker'; +import { strings } from '../../config/localization'; class ProfileScreen extends Component { static navigationOptions = { @@ -40,8 +44,17 @@ import DatePicker from 'react-native-datepicker'; japaneseSchoolName : "", dateFrom:"", dateTo :"", + modalVisible: false, image : "data:image/gif;base64,R0lGODlhGAEYAZEAAP///+Xl5ZmZmQAAACwAAAAAGAEYAQAC/4yPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXzKbzCY1Kp9Sq9YrNarfcrvcLVgrG4bJxjE6r1+y1+b1ry+dzuD1Gz+vV975pDxjo5kfIIXiIKFC4OJHo+KjIKBkAWVk5SWip6Yh5t/mZ2PkGSnooGlaaCnjKpeoayGr1OgsbO0WLq2crldtbtwvlKzwI3DR8jFZsjMysLMYM7fwDTc0m7VOdnXbNo+0dyW3zPQ4eLkP+bQ6Dzq7Owg5f7k4SXz//Vx9/P5Jvvx/Sz9+/DgHzDTRUUOBBDAkVLrTQUN9DhhHhTbxQ0eJFCv8ZNW6U0NHjxwch242EUBLdSZQpx61s0NLkywQxVc5EUNPmTQM5dd7sSW4nT6AudxItOvNo0J9KvRlt6jQpVG1Mp0Z7arVZ1azIsHLtKvUr2JViqb0sa3Yk2rQb17Kd6LZa27hX4dLVavfusbl6h13sO3Yh4L15B/cqbDgX4sS0/jJWvPixKseSZ/GtPJky5lSXN5Pq7PnTx9CfR5MWffK0JrKqL6VuDYk1bE6vZ4eSbVvQ2dy6w/LO4/X3L9/C5QQvbm0rcmLEl2877pyM0OjMmzsXOpS69Onat3PXjj179PDir5PvTp4S9fTqx6cHfx4+dPPK5Vt3X3/9fPy7uyf/y68fgPTdtxx2/nlHIHIG+hfegQ0yuCB6EdonYHEPSvhdgBMOmCGH+/32HoUf8haihh0WWKKHI9rGnogngsheewrGKKNwNNZI4o04sqjjjD3CqOOOrQV5AJBE5khkkbMlucCQTCqg2pNQkiZlk55VaWVlWDKA2ZZcaunllI+FmSVjZJZp2JlipqkmTWa26SabcCo52JxxAmYnTnXmqWdffPap15903iXooHQVWp5biCa61qJCiuUoo5BGemikj2Zl6aVWZVoppXFx+qmlnTo66qKlInpqoakKuuqfrfL5ap6x2jnrnLXCeWubuaq565m9kvlrmMF6GaqoioLaKLJo6WWqKVTMFutpsqQSqqqctI5pa5e8hiZslFjyyCSSP9p4o4orLhmfi7ipq9aB8tTmYH/uvhuZu6DN+9w/+K7izr63SeOvJbsEDMopBGdWyMGN+aHwYaM0LAwqEAemxcRvyWJxNlVk7NMyHHeMxMf9hCxyQkSU3NDJKBek8sojD+FyQC3HLJEQNBsE8801B6HzzkD0LNLPQIOMzdBL2Ww0UjwnnU7OTFPl9NNyRS11XUtXffE0WGdd9NZ4Xe01YUiHLTbYZPsy89kOj6322ma3vTDbcMf99tyupG333VTnjXDdfJcm99+lkFAAADs=", } + + setModalVisible(visible) { + this.setState({modalVisible: true}); + } + + setModalClose() { + this.setState({modalVisible: false}); + } componentWillMount(){ if(this.props.user){ this.setState({ @@ -65,7 +78,25 @@ import DatePicker from 'react-native-datepicker'; //this.props.getUserProfile() } - + _onSetLanguageTo = (value) => { + if(value){ + strings.setLanguage(value); + }else{ + strings.setLanguage('en'); + } + this.setState({modalVisible: false}); + this.props.localization(value); + const resetAction = NavigationActions.reset({ + index: 0, + actions: [ + NavigationActions.navigate({ routeName: 'ProfileMain' }), + ] + }); + + this.props.navigation.dispatch(resetAction); + + } + // updateUserData = async () => { // const { navigation } = this.props; // let toUnixTimestamps = navigation.state.params.finishDate; @@ -82,6 +113,11 @@ import DatePicker from 'react-native-datepicker'; this.props.navigation.navigate('AuthLoading'); }; + _gotoSetting = async () => { + this.props.deleteUserState(); + this.props.navigation.navigate('mainSettings'); + }; + onDateChange = (date) => { this.setState({ graduationDate: date @@ -114,12 +150,76 @@ import DatePicker from 'react-native-datepicker'; } alert("DATA UPDATED"); this.props.updateProfile(sentParse); + }; + + sentActiveClassEN = () => { + if(this.props.lang){ + if(this.props.lang == 'en'){ + return 'modalActive'; + }else{ + return 'modalNonActive'; + } + }else{ + return 'modalActive'; + } + } + + sentActiveClassJA = () => { + if(this.props.lang){ + if(this.props.lang == 'en'){ + return 'modalNonActive'; + }else{ + return 'modalActive'; + } + }else{ + return 'modalNonActive'; + } + } + + -}; - render() { + render() { console.log(this.state.image, "image"); return ( + { + alert('Modal has been closed.'); + }}> + + + { strings['SETTING_LANGUAGES']} + + + { + this._onSetLanguageTo("en"); + }}> + ENGLISH + + + + { + this._onSetLanguageTo("ja"); + }}> + 日本語 + + + + { + this.setModalClose(); + }}> + { strings['PROFILE_MODAL_CLOSE'] } + + + + + @@ -250,8 +350,15 @@ import DatePicker from 'react-native-datepicker'; Update - - Learning Settings + { + this.setModalVisible(true); + }}> + { strings['SETTING_LANGUAGES_PROFILE']} + + + + + Setting @@ -272,7 +379,8 @@ import DatePicker from 'react-native-datepicker'; function mapStateToProps(state, props) { return { - user: state.user.user + user: state.user.user, + lang: state.user.lang } } diff --git a/app/screens/Quiz/quizBeforeList.js b/app/screens/Quiz/quizBeforeList.js index 5ce4b42..6bc0c0c 100644 --- a/app/screens/Quiz/quizBeforeList.js +++ b/app/screens/Quiz/quizBeforeList.js @@ -33,7 +33,6 @@ class QuizBeforeScreen extends Component { this.list = []; this.param = []; - this._onSetLanguageTo('en'); } componentWillMount(){ @@ -54,10 +53,6 @@ class QuizBeforeScreen extends Component { this.list = QuizListData[this.param.headerTitle]; } - _onSetLanguageTo(value) { - strings.setLanguage(value); - } - render() { return ( diff --git a/app/screens/Quiz/quizFlash.js b/app/screens/Quiz/quizFlash.js index 9708029..ad449bb 100644 --- a/app/screens/Quiz/quizFlash.js +++ b/app/screens/Quiz/quizFlash.js @@ -111,12 +111,8 @@ import { this.state = this.initialState; - this._onSetLanguageTo('en'); } - _onSetLanguageTo(value) { - strings.setLanguage(value); - } render() { let display = this.state.timesUp; diff --git a/app/screens/Quiz/quizMain.js b/app/screens/Quiz/quizMain.js index 9965e73..12d5972 100644 --- a/app/screens/Quiz/quizMain.js +++ b/app/screens/Quiz/quizMain.js @@ -19,12 +19,8 @@ class QuizMainScreen extends Component { constructor(props){ super(props); this.list = QuizListData.hiragana_katakana; - this._onSetLanguageTo('en'); } - _onSetLanguageTo(value) { - strings.setLanguage(value); - } render() { return ( diff --git a/app/screens/Setting/mainsetting.js b/app/screens/Setting/mainsetting.js index 2611f71..9404d7e 100644 --- a/app/screens/Setting/mainsetting.js +++ b/app/screens/Setting/mainsetting.js @@ -18,7 +18,7 @@ import { List, ListItem } from 'react-native-elements'; class mainSettings extends Component { render() { return ( - + Setting )} } diff --git a/app/screens/Study/hiraganaList.js b/app/screens/Study/hiraganaList.js index c5fca94..be11453 100644 --- a/app/screens/Study/hiraganaList.js +++ b/app/screens/Study/hiraganaList.js @@ -193,43 +193,43 @@ class HiraganaListScreen extends Component { { strings[this.state.title] } - Learn + { strings['STUDY_LEARN'] } - Start + { strings['STUDY_START'] } - Quiz + { strings['STUDY_QUIZ'] } { scoreQuiz } - Start + { strings['STUDY_START'] } - Review + { strings['STUDY_REVIEW'] } - Test + { strings['STUDY_TEST'] } { scoreTest } - Start + { strings['STUDY_START'] } - Review + { strings['STUDY_REVIEW'] } diff --git a/app/screens/Study/studyList.js b/app/screens/Study/studyList.js index 3c70e9c..c6910a2 100644 --- a/app/screens/Study/studyList.js +++ b/app/screens/Study/studyList.js @@ -30,17 +30,11 @@ class StudyListScreen extends Component { }; constructor() { super(); - this._onSetLanguageTo('en'); - } - _onSetLanguageTo(value) { - strings.setLanguage(value); - //this.setState({}); } setModalVisible(visible) { this.setState({modalVisible: visible}); } - lockedMessage=(item, index)=>{ alert('locked ' + strings[item.title]); } @@ -72,10 +66,16 @@ class StudyListScreen extends Component { header: null, // title: 'Study', }; - + _onSetLanguageTo = (value) => { + if(value){ + strings.setLanguage(value); + }else{ + strings.setLanguage('en'); + } + } render() { var image = ''; - console.log(this.props.fukushu); + this._onSetLanguageTo(this.props.lang); return ( @@ -126,6 +126,7 @@ const study = require('../../styles/study'); function mapStateToProps(state, props) { return { fukushu: state.study.fukushu, + lang : state.user.lang } } diff --git a/app/screens/Summary/studyPick.js b/app/screens/Summary/studyPick.js index b5431d6..9f8666a 100644 --- a/app/screens/Summary/studyPick.js +++ b/app/screens/Summary/studyPick.js @@ -20,11 +20,7 @@ import { StudyList } from '../../config/studyList'; class SummaryTopicList extends Component { constructor() { super(); - this._onSetLanguageTo('en'); } - _onSetLanguageTo(value) { - strings.setLanguage(value); - } static navigationOptions = { title: 'Learn', }; diff --git a/app/screens/Summary/summaryLearn.js b/app/screens/Summary/summaryLearn.js index e0b81ef..3a76fab 100644 --- a/app/screens/Summary/summaryLearn.js +++ b/app/screens/Summary/summaryLearn.js @@ -21,11 +21,7 @@ import { ImageData } from '../../config/image_list'; class SummaryLearnDetail extends Component { constructor() { super(); - this._onSetLanguageTo('en'); } - _onSetLanguageTo(value) { - strings.setLanguage(value); - } static navigationOptions = { title: 'Learn', }; diff --git a/app/screens/home.js b/app/screens/home.js index e660c45..84d748c 100644 --- a/app/screens/home.js +++ b/app/screens/home.js @@ -14,7 +14,8 @@ import { import { List, ListItem , Icon} from 'react-native-elements'; import { AppStack , AuthStack } from '../config/router'; - + import { strings } from '../config/localization'; + import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { ProgressCircle } from 'react-native-svg-charts' @@ -77,8 +78,16 @@ import { return monthNames[datefinish.getMonth()] + " " + datefinish.getDate() + ", " + datefinish.getFullYear(); } + + _onSetLanguageTo = (value) => { + if(value){ + strings.setLanguage(value); + }else{ + strings.setLanguage('en'); + } + } render() { - console.log(this.props.data); + this._onSetLanguageTo(this.props.lang); if(this.props.data.finishDate && this.props.data.startDate){ var diffDays = this.updateDate(this.props.data.finishDate); var targetDate = this.getDateFormat(this.props.data.finishDate); @@ -101,8 +110,8 @@ import { - { diffDays ? ( diffDays ) : ( 0 ) }d Left - Target Date + { diffDays ? ( diffDays ) : ( 0 ) } { strings['HOME_LEFT'] } + { strings['HOME_TARGET'] } { targetDate } @@ -117,26 +126,24 @@ import { - Study + { strings['HOME_STUDY'] } - Summary + { strings['HOME_SUMMARY'] } - Profile + { strings['HOME_PROFILE'] } - - こんにちは!お元気ですか?{'\n'} - 勉強しましょう! + { strings['HOME_MESSAGE']} @@ -189,6 +196,7 @@ function mapStateToProps(state, props) { data: state.user.user, dateFrom: state.summary.dateFrom, dateTo: state.summary.dateTo, + lang : state.user.lang } } diff --git a/app/screens/sketch.js b/app/screens/sketch.js index 7ee643a..a1b9884 100644 --- a/app/screens/sketch.js +++ b/app/screens/sketch.js @@ -12,6 +12,7 @@ import { View, Alert, TouchableOpacity, + TouchableHighlight } from 'react-native'; import RNSketchCanvas from '@terrylinla/react-native-sketch-canvas'; @@ -150,8 +151,6 @@ export default class HL4 extends Component { check += 1; } } - console.log(check/count,"persent"); - if(check == 0){ return false; }else{ @@ -205,7 +204,14 @@ export default class HL4 extends Component { - dasda + HIRAGANA + KATAKANA + RESET + + + NEXT + RANDOM + HOME ); diff --git a/app/styles/profileStyle.js b/app/styles/profileStyle.js index 45c6294..cf21f86 100644 --- a/app/styles/profileStyle.js +++ b/app/styles/profileStyle.js @@ -149,5 +149,67 @@ module.exports = StyleSheet.create({ fontSize: 15, color: 'black', }, + modalContainer : { + height: "100%", + width: "100%", + justifyContent : 'center', + alignItems : 'center' + }, + modalContainerInside : { + backgroundColor : '#ffffff', + height: 200, + width : '100%', + justifyContent : 'center', + alignItems : 'center' + }, + modalTitle : { + fontWeight : 'bold', + fontSize : 20, + }, + modalRow : { + flex : 1, + flexDirection: 'row', + justifyContent:'space-between', + height : 50, + padding: 30, + }, + modalActiveContainer:{ + flex : 1, + padding: 10, + height : 70, + }, + modalActive :{ + justifyContent : 'center', + alignItems : 'center', + borderColor: '#0000ff', + borderWidth : 2, + height: 50, + borderRadius: 10 + }, + modalNonActive :{ + justifyContent : 'center', + alignItems : 'center', + borderColor: '#dddddd', + borderWidth : 2, + height: 50, + borderRadius: 10 + }, + modalClose : { + justifyContent: 'center', + borderColor: '#dddddd', + backgroundColor : '#dddddd', + borderWidth : 2, + borderRadius: 10, + paddingTop: 5 , + paddingBottom: 5 , + paddingLeft: 10 , + paddingRight: 10 , + marginBottom: 10, + }, + modalCloseText : { + fontSize: 14, + color: '#ffffff', + fontWeight : 'bold', + } });