merging access screen translations

This commit is contained in:
Roland Osborne 2023-10-04 14:24:28 -07:00
commit 6b7cbd6cbe
6 changed files with 68 additions and 75 deletions

View File

@ -16,8 +16,8 @@ export function Admin() {
}
catch (err) {
Alert.alert(
"Access Failed",
"Please check your server and token.",
state.strings.error,
state.strings.tryAgain,
);
}
}
@ -32,20 +32,21 @@ export function Admin() {
</View>
<Text style={styles.title}>Databag</Text>
<View style={styles.spacemid}>
<Text style={styles.header}>Admin Acess</Text>
<Text style={styles.header}>{ state.strings.adminAccess }</Text>
</View>
<View style={styles.spacetop}>
<View style={styles.inputwrapper}>
<Ionicons style={styles.icon} name="database" size={18} color="#aaaaaa" />
<TextInput style={styles.inputfield} value={state.server} onChangeText={actions.setServer}
autoCorrect={false} autoCapitalize="none" placeholder="server" placeholderTextColor={Colors.grey} />
autoCorrect={false} autoCapitalize="none" placeholder={state.strings.server}
placeholderTextColor={Colors.inputPlaceholder} />
<View style={styles.space} />
</View>
<View style={styles.inputwrapper}>
<Ionicons style={styles.icon} name="key" size={18} color="#aaaaaa" />
<TextInput style={styles.inputfield} value={state.token} onChangeText={actions.setToken}
secureTextEntry={!state.plainText} autoCapitalize="none" placeholder="token"
placeholderTextColor={Colors.grey} />
secureTextEntry={!state.plainText} autoCapitalize="none" placeholder={state.strings.token}
placeholderTextColor={Colors.inputPlaceholder} />
<TouchableOpacity>
{ state.plainText && (
<Ionicons style={styles.icon} name="eye" size={18} color="#aaaaaa" onPress={actions.hidePass}/>
@ -68,7 +69,7 @@ export function Admin() {
)}
{ !state.enabled && (
<View style={styles.noreset}>
<Text style={styles.noresettext}>Access</Text>
<Text style={styles.noresettext}>{ state.strings.access }</Text>
</View>
)}
</View>
@ -76,7 +77,7 @@ export function Admin() {
<Text style={styles.versiontext}>v{ state.version }</Text>
</View>
</View>
<Modal
<Modal
animationType="fade"
transparent={true}
visible={state.showTerms}
@ -85,11 +86,11 @@ export function Admin() {
>
<View style={styles.modalContainer}>
<ScrollView style={styles.terms} persistentScrollbar={true}>
<Text style={styles.termsheader}>Terms of Use and User Policy</Text>
<Text numberOfLines={0}>{ tos.message }</Text>
<Text style={styles.termsheader}>{ state.strings.policy }</Text>
<Text numberOfLines={0}>{ tos[state.strings.languageCode] }</Text>
</ScrollView>
<TouchableOpacity style={styles.done} onPress={actions.hideTerms}>
<Text style={styles.donetext}>Done</Text>
<Text style={styles.donetext}>{ state.strings.close }</Text>
</TouchableOpacity>
</View>
</Modal>

View File

@ -16,8 +16,8 @@ export function Create() {
}
catch (err) {
Alert.alert(
"Create Failed",
"Please check your server and token.",
state.strings.error,
state.strings.tryAgain,
);
}
}
@ -36,13 +36,14 @@ export function Create() {
</View>
<Text style={styles.title}>Databag</Text>
<View style={styles.spacemid}>
<Text style={styles.header}>Create Account</Text>
<Text style={styles.header}>{ state.strings.createAccount }</Text>
</View>
<ScrollView style={styles.spacetop}>
<View style={styles.inputwrapper}>
<Ionicons style={styles.icon} name="database" size={18} color="#888888" />
<Ionicons style={styles.icon} name="database" size={18} color={Colors.inputPlaceholder} />
<TextInput style={styles.inputfield} value={state.server} onChangeText={actions.setServer}
autoCorrect={false} autoCapitalize="none" placeholder="server" placeholderTextColor={Colors.grey} />
autoCorrect={false} autoCapitalize="none" placeholder={state.strings.server}
placeholderTextColor={Colors.inputPlaceholder} />
{ (!state.server || !state.serverChecked) && (
<View style={styles.required}>
<Text style={styles.requiredtest}></Text>
@ -58,9 +59,10 @@ export function Create() {
<View style={styles.token}>
{ state.tokenRequired && (
<View style={styles.inputwrapper}>
<Ionicons style={styles.icon} name="key" size={18} color="#888888" />
<Ionicons style={styles.icon} name="key" size={18} color={Colors.inputPlaceholder} />
<TextInput style={styles.inputfield} value={state.token} onChangeText={actions.setToken}
autoCorrect={false} autoCapitalize="none" placeholder="token" placeholderTextColor={Colors.grey} />
autoCorrect={false} autoCapitalize="none" placeholder={state.strings.token}
placeholderTextColor={Colors.inputPlaceholder} />
<View style={styles.space}>
{ (!validServer || !state.token || !state.tokenChecked) && (
<Text style={styles.required}></Text>
@ -76,14 +78,15 @@ export function Create() {
)}
{ !state.tokenRequired && state.server === 'databag.coredb.org' && (
<View style={styles.demo}>
<Text style={styles.demoText}>The default public server is to test out the system. Use a private server otherwise.</Text>
<Text style={styles.demoText}>{state.strings.defaultPublic}</Text>
</View>
)}
</View>
<View style={styles.inputwrapper}>
<Ionicons style={styles.icon} name="user" size={18} color="#888888" />
<Ionicons style={styles.icon} name="user" size={18} color={Colors.inputPlaceholder} />
<TextInput style={styles.inputfield} value={state.username} onChangeText={actions.setUsername}
autoCorrect={false} autoCapitalize="none" placeholder="username" placeholderTextColor={Colors.grey} />
autoCorrect={false} autoCapitalize="none" placeholder={state.strings.username}
placeholderTextColor={Colors.inputPlaceholder} />
{ (!validServer || !validToken || !state.username || !state.usernameChecked) && (
<Text style={styles.required}></Text>
)}
@ -96,48 +99,48 @@ export function Create() {
</View>
{ state.showPassword && (
<View style={styles.inputwrapper}>
<Ionicons style={styles.icon} name="lock" size={18} color="#888888" />
<Ionicons style={styles.icon} name="lock" size={18} color={Colors.inputPlaceholder} />
<TextInput style={styles.inputfield} value={state.password} onChangeText={actions.setPassword}
autoCorrect={false} autoCapitalize="none" placeholder="password" placeholderTextColor={Colors.grey} />
autoCorrect={false} autoCapitalize="none" placeholder={state.strings.password}
placeholderTextColor={Colors.inputPlaceholder} />
<TouchableOpacity onPress={actions.hidePassword}>
<Ionicons style={styles.icon} name="eye" size={18} color="#888888" />
<Ionicons style={styles.icon} name="eye" size={18} color={Colors.inputPlaceholder} />
</TouchableOpacity>
</View>
)}
{ !state.showPassword && (
<View style={styles.inputwrapper}>
<Ionicons style={styles.icon} name="lock" size={18} color="#888888" />
<Ionicons style={styles.icon} name="lock" size={18} color={Colors.inputPlaceholder} />
<TextInput style={styles.inputfield} value={state.password} onChangeText={actions.setPassword}
autoCorrect={false} secureTextEntry={true} autoCapitalize="none" placeholder="password"
placeholderTextColor={Colors.grey} />
autoCorrect={false} secureTextEntry={true} autoCapitalize="none" placeholder={state.strings.password}
placeholderTextColor={Colors.inputPlaceholder} />
<TouchableOpacity onPress={actions.showPassword}>
<Ionicons style={styles.icon} name="eyeo" size={18} color="#888888" />
<Ionicons style={styles.icon} name="eyeo" size={18} color={Colors.inputPlaceholder} />
</TouchableOpacity>
</View>
)}
{ state.showConfirm && (
<View style={styles.inputwrapper}>
<Ionicons style={styles.icon} name="lock" size={18} color="#888888" />
<Ionicons style={styles.icon} name="lock" size={18} color={Colors.inputPlaceholder} />
<TextInput style={styles.inputfield} value={state.confirm} onChangeText={actions.setConfirm}
autoCorrect={false} autoCapitalize="none" placeholder="confirm password"
placeholderTextColor={Colors.grey} />
autoCorrect={false} autoCapitalize="none" placeholder={state.strings.confirmPassword}
placeholderTextColor={Colors.inputPlaceholder} />
<TouchableOpacity onPress={actions.hideConfirm}>
<Ionicons style={styles.icon} name="eye" size={18} color="#888888" />
<Ionicons style={styles.icon} name="eye" size={18} color={Colors.inputPlaceholder} />
</TouchableOpacity>
</View>
)}
{ !state.showConfirm && (
<View style={styles.inputwrapper}>
<Ionicons style={styles.icon} name="lock" size={18} color="#888888" />
<Ionicons style={styles.icon} name="lock" size={18} color={Colors.inputPlaceholder} />
<TextInput style={styles.inputfield} value={state.confirm} onChangeText={actions.setConfirm}
autoCorrect={false} secureTextEntry={true} autoCapitalize="none" placeholder="confirm password"
placeholderTextColor={Colors.grey} />
autoCorrect={false} secureTextEntry={true} autoCapitalize="none" placeholder={state.strings.confirmPassword}
placeholderTextColor={Colors.inputPlaceholder} />
<TouchableOpacity onPress={actions.showConfirm}>
<Ionicons style={styles.icon} name="eyeo" size={18} color="#888888" />
<Ionicons style={styles.icon} name="eyeo" size={18} color={Colors.inputPlaceholder} />
</TouchableOpacity>
</View>
)}
<View style={styles.buttons}>
{ state.enabled && (
<TouchableOpacity style={styles.create} onPress={create}>
@ -145,17 +148,17 @@ export function Create() {
<ActivityIndicator size="small" color="#ffffff" />
)}
{ !state.busy && (
<Text style={styles.createtext}>Create Account</Text>
<Text style={styles.createtext}>{ state.strings.create }</Text>
)}
</TouchableOpacity>
)}
{ !state.enabled && (
<View style={styles.nocreate}>
<Text style={styles.nocreatetext}>Create Account</Text>
<Text style={styles.nocreatetext}>{ state.strings.create }</Text>
</View>
)}
<TouchableOpacity style={styles.login} onPress={actions.login}>
<Text style={styles.logintext}>Account Login</Text>
<Text style={styles.logintext}>{ state.strings.accountLogin }</Text>
</TouchableOpacity>
</View>
</ScrollView>
@ -169,11 +172,11 @@ export function Create() {
>
<View style={styles.modalContainer}>
<ScrollView style={styles.terms} persistentScrollbar={true}>
<Text style={styles.termsheader}>Terms of Use and User Policy</Text>
<Text numberOfLines={0}>{ tos.message }</Text>
<Text style={styles.termsheader}>{ state.strings.policy }</Text>
<Text numberOfLines={0}>{ tos[state.strings.languageCode] }</Text>
</ScrollView>
<TouchableOpacity style={styles.done} onPress={actions.hideTerms}>
<Text style={styles.donetext}>Done</Text>
<Text style={styles.donetext}>{ state.strings.close }</Text>
</TouchableOpacity>
</View>
</Modal>

View File

@ -103,7 +103,7 @@ export function Login() {
<Text numberOfLines={0}>{ tos[state.strings.languageCode] }</Text>
</ScrollView>
<TouchableOpacity style={styles.done} onPress={actions.hideTerms}>
<Text style={styles.donetext}>{ state.strings.done }</Text>
<Text style={styles.donetext}>{ state.strings.close }</Text>
</TouchableOpacity>
</View>
</Modal>

View File

@ -16,8 +16,8 @@ export function Reset() {
}
catch (err) {
Alert.alert(
"Access Failed",
"Please check your server and token.",
state.strings.error,
state.strings.tryAgain,
);
}
}
@ -32,19 +32,19 @@ export function Reset() {
</View>
<Text style={styles.title}>Databag</Text>
<View style={styles.spacemid}>
<Text style={styles.header}>Access Account</Text>
<Text style={styles.header}>{ state.strings.accessAccount }</Text>
</View>
<View style={styles.spacetop}>
<View style={styles.inputwrapper}>
<Ionicons style={styles.icon} name="database" size={18} color="#aaaaaa" />
<TextInput style={styles.inputfield} value={state.server} onChangeText={actions.setServer}
autoCapitalize="none" placeholder="server" placeholderTextColor={Colors.grey} />
autoCapitalize="none" placeholder={state.strings.server} placeholderTextColor={Colors.inputPlaceholder} />
<View style={styles.space} />
</View>
<View style={styles.inputwrapper}>
<Ionicons style={styles.icon} name="key" size={18} color="#aaaaaa" />
<TextInput style={styles.inputfield} value={state.token} onChangeText={actions.setToken}
autoCapitalize="none" placeholder="token" placeholderTextColor={Colors.grey} />
autoCapitalize="none" placeholder={state.strings.token} placeholderTextColor={Colors.inputPlaceholder} />
<View style={styles.space} />
</View>
@ -54,17 +54,17 @@ export function Reset() {
<ActivityIndicator size="small" color="#ffffff" />
)}
{ !state.busy && (
<Text style={styles.resettext}>Access</Text>
<Text style={styles.resettext}>{ state.strings.access }</Text>
)}
</TouchableOpacity>
)}
{ !state.enabled && (
<View style={styles.noreset}>
<Text style={styles.noresettext}>Access</Text>
<Text style={styles.noresettext}>{ state.strings.access }</Text>
</View>
)}
<TouchableOpacity style={styles.login} onPress={actions.login}>
<Text style={styles.logintext}>Account Login</Text>
<Text style={styles.logintext}>{ state.strings.accountLogin }</Text>
</TouchableOpacity>
</View>
</View>
@ -77,11 +77,11 @@ export function Reset() {
>
<View style={styles.modalContainer}>
<ScrollView style={styles.terms} persistentScrollbar={true}>
<Text style={styles.termsheader}>Terms of Use and User Policy</Text>
<Text numberOfLines={0}>{ tos.message }</Text>
<Text style={styles.termsheader}>{ state.strings.policy }</Text>
<Text numberOfLines={0}>{ tos[state.strings.languageCode] }</Text>
</ScrollView>
<TouchableOpacity style={styles.done} onPress={actions.hideTerms}>
<Text style={styles.donetext}>Done</Text>
<TouchableOpacity style={styles.close} onPress={actions.hideTerms}>
<Text style={styles.donetext}>{ state.strings.done }</Text>
</TouchableOpacity>
</View>
</Modal>

View File

@ -10,7 +10,7 @@ export function useReset() {
const app = useContext(AppContext);
const [state, setState] = useState({
stirngs: getLanguageStrings(),
strings: getLanguageStrings(),
busy: false,
enabled: false,
server: null,

View File

@ -176,7 +176,7 @@ const Strings = [
adminAccess: 'Admin Access',
server: 'Server',
access: 'Access',
defaultPublish: 'The default public server is to test out the system. Use a private server otherwise.',
defaultPublic: 'The default public server is to test out the system. Use a private server otherwise.',
confirmPassword: 'Confirm Password',
accountLogin: 'Account Login',
accessAccount: 'Access Account',
@ -349,24 +349,13 @@ const Strings = [
fontColor: 'Couleur du Texte',
selectedColor: 'Couleur Sélectionnée',
login: 'Login',
createAccount: 'Create Account',
forgotPassword: 'Forgot Password',
adminAccess: 'Admin Access',
server: 'Server',
access: 'Access',
defaultPublish: 'The default public server is to test out the system. Use a private server otherwise.',
confirmPassword: 'Confirm Password',
accountLogin: 'Account Login',
accessAccount: 'Access Account',
login: 'Connexion',
createAccount: 'Créer un Compte',
forgotPassword: 'Mot de Passe Oublié',
adminAccess: 'Accès Administrateur',
server: 'Serveur',
access: 'Accès',
defaultPublish: 'Le serveur public par défaut est destiné à tester le système. Utilisez un serveur privé sinon.',
defaultPublic: 'Le serveur public par défaut est destiné à tester le système. Utilisez un serveur privé sinon.',
confirmPassword: 'Confirmer le Mot de Passe',
accountLogin: 'Connexion au Compte',
accessAccount: 'Accéder au Compte',
@ -545,7 +534,7 @@ const Strings = [
adminAccess: 'Acceso de administrador',
server: 'Servidor',
access: 'Acceso',
defaultPublish: 'El servidor público predeterminado es para probar el sistema. Utilice un servidor privado en caso contrario.',
defaultPublic: 'El servidor público predeterminado es para probar el sistema. Utilice un servidor privado en caso contrario.',
confirmPassword: 'Confirmar contraseña',
accountLogin: 'Iniciar sesión en la cuenta',
accessAccount: 'Acceder a la cuenta',
@ -724,7 +713,7 @@ const Strings = [
adminAccess: 'Administratorzugang',
server: 'Server',
access: 'Zugang',
defaultPublish: 'Der Standard-Public-Server dient dazu, das System zu testen. Verwenden Sie andernfalls einen privaten Server.',
defaultPublic: 'Der Standard-Public-Server dient dazu, das System zu testen. Verwenden Sie andernfalls einen privaten Server.',
confirmPassword: 'Passwort bestätigen',
accountLogin: 'Kontoanmeldung',
accessAccount: 'Zugang zum Konto',
@ -889,7 +878,7 @@ const Strings = [
adminAccess: 'Acesso de Administrador',
server: 'Servidor',
access: 'Acesso',
defaultPublish: 'O servidor público padrão serve para testar o sistema. Use um servidor privado, caso contrário.',
defaultPublic: 'O servidor público padrão serve para testar o sistema. Use um servidor privado, caso contrário.',
confirmPassword: 'Confirmar Senha',
accountLogin: 'Login da Conta',
accessAccount: 'Acessar Conta',
@ -900,9 +889,9 @@ const Strings = [
];
export function getLanguageStrings() {
const locale = Platform.OS === 'ios' ? NativeModules.SettingsManager.settings.AppleLocale || NativeModules.SettingsManager.settings.AppleLanguages[0] : NativeModules.I18nManager.localeIdentifier;
const locale = Platform.OS === 'ios' ? NativeModules.SettingsManager?.settings.AppleLocale || NativeModules.SettingsManager?.settings.AppleLanguages[0] : NativeModules.I18nManager?.localeIdentifier;
const lang = locale.slice(0, 2) || '';
const lang = locale?.slice(0, 2) || '';
if (lang === 'en') {
return Strings[0];