translating add topic component

This commit is contained in:
Roland Osborne 2023-10-03 14:22:57 -07:00
parent 22eafd10ff
commit d2cec19b43
4 changed files with 48 additions and 14 deletions

View File

@ -160,6 +160,14 @@ const Strings = [
relayUrl: 'Relay URL', relayUrl: 'Relay URL',
relayUsername: 'Relay Username', relayUsername: 'Relay Username',
relayPassword: 'Relay Password', relayPassword: 'Relay Password',
newMessage: 'New Message',
fontSize: 'Font Size',
small: 'Small',
medium: 'Medium',
large: 'Large',
fontColor: 'Font Color',
selectedColor: 'Selected Color',
}, },
{ {
visibleRegistry: 'Visible dans le Registre', visibleRegistry: 'Visible dans le Registre',
@ -316,6 +324,14 @@ const Strings = [
relayUrl: 'URL de Relais', relayUrl: 'URL de Relais',
relayUsername: 'Nom d\'Utilisateur du Relais', relayUsername: 'Nom d\'Utilisateur du Relais',
relayPassword: 'Mot de Passe du Relais', relayPassword: 'Mot de Passe du Relais',
newMessage: 'Nouveau Message',
fontSize: 'Taille du Texte',
small: 'Petit',
medium: 'Moyen',
large: 'Grand',
fontColor: 'Couleur du Texte',
selectedColor: 'Couleur Sélectionnée',
}, },
{ {
visibleRegistry: 'Visible en el Registro', visibleRegistry: 'Visible en el Registro',
@ -472,6 +488,14 @@ const Strings = [
relayUrl: 'URL para Llamadas', relayUrl: 'URL para Llamadas',
relayUsername: 'Nombre de Usuario para Llamadas', relayUsername: 'Nombre de Usuario para Llamadas',
relayPassword: 'Contraseña para Llamadas', relayPassword: 'Contraseña para Llamadas',
newMessage: 'Nuevo Mensaje',
fontSize: 'Tamano del Texto',
small: 'Pequeño',
medium: 'Medio',
large: 'Grande',
fontColor: 'Color de Texto',
selectedColor: 'Color Seleccionado',
}, },
{ {
visibleRegistry: 'Sichtbar in der Registrierung', visibleRegistry: 'Sichtbar in der Registrierung',
@ -628,6 +652,14 @@ const Strings = [
relayUrl: 'URL für Anrufe', relayUrl: 'URL für Anrufe',
relayUsername: 'Benutzername für Anrufe', relayUsername: 'Benutzername für Anrufe',
relayPassword: 'Passwort für Anrufe', relayPassword: 'Passwort für Anrufe',
newMessage: 'Neue Nachricht',
fontSize: 'Textgröße',
small: 'Klein',
medium: 'Mittel',
large: 'Groß',
fontColor: 'Textfarbe',
selectedColor: 'Ausgewählte Farbe',
} }
]; ];

View File

@ -175,7 +175,7 @@ export function AddTopic({ contentKey, shareIntent, setShareIntent }) {
<TextInput style={{ ...styles.input, color: state.color, fontSize: state.textSize }} value={state.message} onChangeText={actions.setMessage} <TextInput style={{ ...styles.input, color: state.color, fontSize: state.textSize }} value={state.message} onChangeText={actions.setMessage}
placeholderTextColor={state.color} cursorColor={state.color} placeholderTextColor={state.color} cursorColor={state.color}
blurOnSubmit={true} onSubmitEditing={sendMessage} returnKeyType="send" blurOnSubmit={true} onSubmitEditing={sendMessage} returnKeyType="send"
autoCapitalize="sentences" placeholder="New Message" multiline={true} /> autoCapitalize="sentences" placeholder={state.strings.newMessage} multiline={true} />
<View style={styles.addButtons}> <View style={styles.addButtons}>
{ state.enableImage && ( { state.enableImage && (
<TouchableOpacity style={styles.addButton} onPress={addImage}> <TouchableOpacity style={styles.addButton} onPress={addImage}>
@ -232,43 +232,43 @@ export function AddTopic({ contentKey, shareIntent, setShareIntent }) {
<BlurView style={styles.modalOverlay} blurType={Colors.overlay} blurAmount={2} reducedTransparencyFallbackColor="black" /> <BlurView style={styles.modalOverlay} blurType={Colors.overlay} blurAmount={2} reducedTransparencyFallbackColor="black" />
<View style={styles.modalBase} behavior={Platform.OS === 'ios' ? 'padding' : 'height'}> <View style={styles.modalBase} behavior={Platform.OS === 'ios' ? 'padding' : 'height'}>
<View style={styles.modalContainer}> <View style={styles.modalContainer}>
<Text style={styles.editHeader}>Font Size:</Text> <Text style={styles.editHeader}>{ state.strings.fontSize }</Text>
<View style={styles.editSize}> <View style={styles.editSize}>
{ state.size === 'small' && ( { state.size === 'small' && (
<View style={styles.selected}> <View style={styles.selected}>
<Text style={styles.selectedText}>Small</Text> <Text style={styles.selectedText}>{ state.strings.small }</Text>
</View> </View>
)} )}
{ state.size !== 'small' && ( { state.size !== 'small' && (
<TouchableOpacity style={styles.option} onPress={() => actions.setFontSize('small')}> <TouchableOpacity style={styles.option} onPress={() => actions.setFontSize('small')}>
<Text style={styles.optionText}>Small</Text> <Text style={styles.optionText}>{ state.strings.small }</Text>
</TouchableOpacity> </TouchableOpacity>
)} )}
{ state.size === 'medium' && ( { state.size === 'medium' && (
<View style={styles.selected}> <View style={styles.selected}>
<Text style={styles.selectedText}>Medium</Text> <Text style={styles.selectedText}>{ state.strings.medium }</Text>
</View> </View>
)} )}
{ state.size !== 'medium' && ( { state.size !== 'medium' && (
<TouchableOpacity style={styles.option} onPress={() => actions.setFontSize('medium')}> <TouchableOpacity style={styles.option} onPress={() => actions.setFontSize('medium')}>
<Text style={styles.optionText}>Medium</Text> <Text style={styles.optionText}>{ state.strings.medium }</Text>
</TouchableOpacity> </TouchableOpacity>
)} )}
{ state.size === 'large' && ( { state.size === 'large' && (
<View style={styles.selected}> <View style={styles.selected}>
<Text style={styles.selectedText}>Large</Text> <Text style={styles.selectedText}>{ state.strings.large }</Text>
</View> </View>
)} )}
{ state.size !== 'large' && ( { state.size !== 'large' && (
<TouchableOpacity style={styles.option} onPress={() => actions.setFontSize('large')}> <TouchableOpacity style={styles.option} onPress={() => actions.setFontSize('large')}>
<Text style={styles.optionText}>Large</Text> <Text style={styles.optionText}>{ state.strings.large }</Text>
</TouchableOpacity> </TouchableOpacity>
)} )}
</View> </View>
<View style={styles.editControls}> <View style={styles.editControls}>
<View style={styles.selection} /> <View style={styles.selection} />
<TouchableOpacity style={styles.close} onPress={actions.hideFontSize}> <TouchableOpacity style={styles.close} onPress={actions.hideFontSize}>
<Text style={styles.closeText}>Close</Text> <Text style={styles.closeText}>{ state.strings.close }</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>
@ -286,7 +286,7 @@ export function AddTopic({ contentKey, shareIntent, setShareIntent }) {
<BlurView style={styles.modalOverlay} blurType={Colors.overlay} blurAmount={2} reducedTransparencyFallbackColor="black" /> <BlurView style={styles.modalOverlay} blurType={Colors.overlay} blurAmount={2} reducedTransparencyFallbackColor="black" />
<View style={styles.modalBase} behavior={Platform.OS === 'ios' ? 'padding' : 'height'}> <View style={styles.modalBase} behavior={Platform.OS === 'ios' ? 'padding' : 'height'}>
<View style={styles.modalContainer}> <View style={styles.modalContainer}>
<Text style={styles.editHeader}>Font Color:</Text> <Text style={styles.editHeader}>{ state.strings.fontColor }</Text>
<View style={styles.editColor}> <View style={styles.editColor}>
<ColorPicker <ColorPicker
color={state.color} color={state.color}
@ -297,11 +297,11 @@ export function AddTopic({ contentKey, shareIntent, setShareIntent }) {
</View> </View>
<View style={styles.editControls}> <View style={styles.editControls}>
<View style={styles.selection}> <View style={styles.selection}>
<Text style={styles.selectionText}>Set Color:</Text> <Text style={styles.selectionText}>{ state.strings.selectedColor }</Text>
<View style={{ marginLeft: 6, borderRadius: 4, width: 16, height: 16, backgroundColor: state.color }} /> <View style={{ marginLeft: 6, borderRadius: 4, width: 16, height: 16, backgroundColor: state.color }} />
</View> </View>
<TouchableOpacity style={styles.close} onPress={actions.hideFontColor}> <TouchableOpacity style={styles.close} onPress={actions.hideFontColor}>
<Text style={styles.closeText}>Close</Text> <Text style={styles.closeText}>{ state.strings.close }</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>

View File

@ -22,8 +22,8 @@ export const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
borderRadius: 4, borderRadius: 4,
marginLeft: 8, marginLeft: 4,
marginRight: 8, marginRight: 4,
}, },
input: { input: {
marginLeft: 16, marginLeft: 16,

View File

@ -7,10 +7,12 @@ import { encryptBlock, decryptBlock, getChannelSeals, getContentKey, encryptTopi
import { AccountContext } from 'context/AccountContext'; import { AccountContext } from 'context/AccountContext';
import RNFS from 'react-native-fs'; import RNFS from 'react-native-fs';
import ImageResizer from '@bam.tech/react-native-image-resizer'; import ImageResizer from '@bam.tech/react-native-image-resizer';
import { getLanguageStrings } from 'constants/Strings';
export function useAddTopic(contentKey) { export function useAddTopic(contentKey) {
const [state, setState] = useState({ const [state, setState] = useState({
strings: getLanguageStrings(),
message: null, message: null,
assets: [], assets: [],
fontSize: false, fontSize: false,