Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#11] Translate Screen: implement feature and fix issue #110

Merged
merged 2 commits into from
Aug 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions react-native/components/BottomDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import { StyleSheet, Dimensions, View, TouchableOpacity, TouchableHighlight, ScrollView, Alert, Linking } from 'react-native';
import { StyleSheet, Dimensions, View, TouchableOpacity, TouchableHighlight, ScrollView, Alert, Linking, TouchableWithoutFeedback } from 'react-native';
import { MaterialIcons } from '@expo/vector-icons';
import { Popover, Button, Text, Modal, FormControl, Input, VStack, CheckIcon, AlertDialog } from 'native-base';
import { Popover, Button, Text, Modal, FormControl, Input, VStack, HStack, AlertDialog } from 'native-base';
import { theme } from '../core/theme';
import type { BottomDrawerProps, EventForm, ResultsForm, UserData } from '../types';
import { useAuth } from '../contexts/Auth';
Expand Down Expand Up @@ -152,15 +152,20 @@ function BottomDrawer(props: BottomDrawerProps) {
<View style={{ flex: 1 }}>
<View style={styles.horizontalLine} />
<View style={[styles.spaceBetween, { paddingBottom: 24 }]}>
<Text fontFamily="heading" fontWeight={700} fontStyle="normal" fontSize='2xl' color="primary.500">{props.showKorean ? i18n.t('korean') : i18n.t('translation')}</Text>
<View style={styles.alignRow}>
<Text fontFamily="heading" fontWeight={700} fontStyle="normal" fontSize='2xl' color="primary.500">{props.showKorean ? i18n.t('korean') : i18n.t('translation')}</Text>
<HStack space={2}>
<TouchableOpacity onPress={props.handleKorean}>
<MaterialIcons name="translate" size={32} color="#000"/>
</TouchableOpacity>
</View>
<TouchableOpacity onPress={props.copyToClipboard}>
<MaterialIcons name="content-copy" size={32} color="black" />
</TouchableOpacity>
</HStack>
</View>

<ScrollView style={{ flex: 1 }}>
{/* <View style={{paddingBottom: 10, marginBottom: 10, flex: 1}}> */}
<ScrollView style={{ flex: 1 }}>
<TouchableWithoutFeedback>
<Text fontFamily="body" fontWeight={500} fontStyle="normal" fontSize='md' lineHeight='xl'>
{!props.showKorean ? (
props.results?.fullText?.map((item, index) =>
Expand Down Expand Up @@ -296,15 +301,17 @@ function BottomDrawer(props: BottomDrawerProps) {
</Popover>
) : (
<Text key={item.content}>
{item.content.slice(72)}
{item.content}
</Text>
)
)
) : (
<Text>{props.results?.korean}</Text>
)}
</Text>
</TouchableWithoutFeedback>
</ScrollView>
{/* </View> */}
</View>
{props.isTranslateScreen &&
<View style={[styles.spaceBetween, props.isFullDrawer && styles.full ]}>
Expand Down
1 change: 1 addition & 0 deletions react-native/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default {
translateMessage_1: "You can add a schedule to the calendar by clicking the highlighted text.",
translateMessage_2: "You must enter at least one character for the title.",
saveAlarm: 'Results have been saved',
copiedToClipboard: "Copied to Clipboard",
/* BottomDrawer */
sessionExpired: "The session has expired. Please log in again.",
helpertext: "Give your results a title.",
Expand Down
3 changes: 2 additions & 1 deletion react-native/locales/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ export default {
saveFirst: "保存ボタンを押して結果を保存してください!",
eventNotFound: "イベントが見つかりませんでした",
noResults: "まだ結果はありません。",
translateFirst: "結果を翻訳して保存する。"
translateFirst: "結果を翻訳して保存する。",
copiedToClipboard: "クリップボードにコピーしました",
}
3 changes: 2 additions & 1 deletion react-native/locales/km.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ export default {
saveFirst: "ចុចប៊ូតុង Save ដើម្បីរក្សាទុកលទ្ធផលជាមុន!",
eventNotFound: "រកមិនឃើញព្រឹត្តិការណ៍ទេ។",
noResults: "មិនទាន់មានលទ្ធផលនៅឡើយទេ។",
translateFirst: "បកប្រែ និងរក្សាទុកលទ្ធផល។"
translateFirst: "បកប្រែ និងរក្សាទុកលទ្ធផល។",
copiedToClipboard: "បានចម្លងទៅក្ដារតម្បៀតខ្ទាស់",
}
3 changes: 2 additions & 1 deletion react-native/locales/ko.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ export default {
saveFirst: "저장 버튼을 눌러서 결과 저장을 먼저 해주세요!",
eventNotFound: "이벤트를 찾지 못했어요",
noResults: "아직 결과가 없습니다.",
translateFirst: "번역을 한 후에 결과를 저장해주세요."
translateFirst: "번역을 한 후에 결과를 저장해주세요.",
copiedToClipboard: "클립보드에 복사되었습니다",
}
3 changes: 2 additions & 1 deletion react-native/locales/th.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ export default {
saveFirst: "คลิกปุ่มบันทึกเพื่อบันทึกผลลัพธ์ก่อน!",
eventNotFound: "ไม่พบกิจกรรม",
noResults: "ยังไม่มีผลลัพธ",
translateFirst: "แปลและบันทึกผลลัพธ์"
translateFirst: "แปลและบันทึกผลลัพธ์",
copiedToClipboard: "คัดลอกไปยังคลิปบอร์ดแล้ว",
}
3 changes: 2 additions & 1 deletion react-native/locales/vn.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ export default {
saveFirst: "Nhấp vào nút Lưu để lưu kết quả trước!",
eventNotFound: "Không tìm thấy sự kiện nào",
noResults: "Chưa có kết quả.",
translateFirst: "Dịch và lưu kết quả."
translateFirst: "Dịch và lưu kết quả.",
copiedToClipboard: "Sao chép vào clipboard",
}
3 changes: 2 additions & 1 deletion react-native/locales/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ export default {
saveFirst: "单击保存按钮首先保存结果!",
eventNotFound: "未找到任何事件",
noResults: "目前还没有结果。",
translateFirst: "翻译并保存结果。"
translateFirst: "翻译并保存结果。",
copiedToClipboard: "已复制到剪贴板",
}
Loading