Skip to content

Commit

Permalink
fix: added translations for missing strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
CurtlyCritchlow committed Nov 26, 2024
1 parent 9a7212d commit 1b7774d
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:npt_flutter/features/logging/logging.dart';
import 'package:npt_flutter/styles/sizes.dart';

Expand All @@ -11,7 +12,7 @@ class DebugDumpLogsButton extends StatelessWidget {
Widget build(BuildContext context) {
if (!kDebugMode) return gap0;
return ElevatedButton(
child: const Text("Dev: Dump Logs to terminal"),
child: Text(AppLocalizations.of(context)!.debugDumpLogTitle),
onPressed: () {
var list = context.read<LogsCubit>().logs;
for (final line in list) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:developer';
import 'dart:io';

import 'package:at_contacts_flutter/at_contacts_flutter.dart';
import 'package:at_onboarding_flutter/at_onboarding_flutter.dart';
Expand All @@ -17,6 +18,7 @@ import 'package:npt_flutter/features/onboarding/util/onboarding_util.dart';
import 'package:npt_flutter/features/onboarding/widgets/activate_atsign_dialog.dart';
import 'package:npt_flutter/features/onboarding/widgets/onboarding_dialog.dart';
import 'package:npt_flutter/routes.dart';
import 'package:npt_flutter/util/language.dart';
import 'package:path_provider/path_provider.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';

Expand Down Expand Up @@ -189,8 +191,8 @@ class _OnboardingButtonState extends State<OnboardingButton> {
}
AtOnboardingConstants.setApiKey(apiKey);
AtOnboardingConstants.rootDomain = util.config.atClientPreference.rootDomain;
// TODO: localize locale - right now hardcoded to english
await AtOnboardingLocalizations.load(const Locale("en"));

await AtOnboardingLocalizations.load(LanguageUtil.getLanguageFromLocale(Locale(Platform.localeName)).locale);
if (!mounted) return null;
Map<String, String> apis = {
"root.atsign.org": "my.atsign.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class OnboardingDialog extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text("Select or type the client atSign"),
Text(strings.selectorTitleAtsign),
gapH16,
AtsignSelector(
options: options,
),
gapH16,
const Text("Select or type the root domain"),
Text(strings.selectorTitleRootDomain),
AtDirectorySelector(
options: options,
),
Expand All @@ -53,7 +53,7 @@ class OnboardingDialog extends StatelessWidget {
onPressed: () {
Navigator.of(context).pop(true);
},
child: const Text("Next"),
child: Text(strings.next),
),
],
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class ProfileHeaderView extends StatelessWidget {
);

case ProfileListFailedLoad _:
return const Row(
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Failed to load this profile, please refresh manually:"),
ProfileListRefreshButton(),
Text(strings.errorProfileLoadFailed),
const ProfileListRefreshButton(),
],
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:npt_flutter/features/profile/profile.dart';
import 'package:npt_flutter/features/settings/settings.dart';
import 'package:npt_flutter/styles/sizes.dart';
Expand Down Expand Up @@ -28,11 +29,11 @@ class ProfileView extends StatelessWidget {
);

case ProfileFailedLoad _:
return const Row(
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Failed to load this profile, please refresh manually:"),
ProfileRefreshButton(),
Text(AppLocalizations.of(context)!.errorProfileLoadFailed),
const ProfileRefreshButton(),
],
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:npt_flutter/features/profile/profile.dart';

class ProfileRefreshButton extends StatelessWidget {
Expand All @@ -10,11 +11,9 @@ class ProfileRefreshButton extends StatelessWidget {
return BlocBuilder<ProfileBloc, ProfileState>(
builder: (BuildContext context, ProfileState state) => ElevatedButton(
onPressed: () {
context
.read<ProfileBloc>()
.add(const ProfileLoadEvent(useCache: false));
context.read<ProfileBloc>().add(const ProfileLoadEvent(useCache: false));
},
child: const Text("Refresh"),
child: Text(AppLocalizations.of(context)!.refresh),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class ProfileListView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text("Failed to load profiles"),
Text(strings.profilesFailedLoaded),
ElevatedButton(
child: const Text("Reload"),
child: Text(strings.reload),
onPressed: () {
context.read<ProfileListBloc>().add(const ProfileListLoadEvent());
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:npt_flutter/features/settings/settings.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class SettingsErrorHint extends StatelessWidget {
const SettingsErrorHint({
Expand All @@ -19,7 +20,7 @@ class SettingsErrorHint extends StatelessWidget {
return BlocSelector<SettingsBloc, SettingsState, bool>(selector: (state) {
return state is SettingsFailedLoad;
}, builder: (context, hasError) {
if (hasError) return const Text("Error loading profile");
if (hasError) return Text(AppLocalizations.of(context)!.profileFailedLoaded);
return Container();
});
}
Expand Down
52 changes: 29 additions & 23 deletions packages/dart/npt_flutter/lib/localization/app_en.arb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"activationStatusActivating" : "Activating",
"activationStatusOtpWait" : "Please enter the OTP from your email",
"activationStatusPreparing" : "Preparing for activation",
"addNew" : "Add New",
"addNewProfile" : "Add New Profile",
"advanced": "Advanced",
Expand All @@ -11,12 +14,14 @@
"atsignDialogSubtitle" : "Please select your atSign",
"atsignDialogTitle" : "AtSign",
"back" : "Back",
"backupKeyDialogTitle" : "Please select a file to export to:",
"backupYourKey" : "Backup Your Key",
"cancel" : "Cancel",
"confirm" : "Confirm",
"connected" : "connected",
"dashboard" : "Dashboard",
"dashboardView" : "Dashboard View",
"debugDumpLogTitle" : "Dev: Dump Logs to terminal",
"defaultRelaySelection" : "Default Relay Selection",
"delete" : "Delete",
"deviceAtsign" : "Device atSign",
Expand All @@ -31,6 +36,22 @@
"email" : "Email",
"emptyProfileMessage" : "No profiles found\nCreate or Import a profile to start using NoPorts.",
"enableLogging" : "Enable Logging",
"errorAtKeySaveFailed" : "Failed to save the atKeys file: {error}",
"errorAtKeysFileProcessFailed" : "Failed to process the atKeys file",
"errorAtKeysInvalid" : "Invalid atKeys file detected",
"errorAtKeysUploadedMismatch" : "The atKeys file you uploaded did not match the atSign requested",
"errorAtServerUnavailable": "Failed to retrieve the atserver status, make sure you have a stable internet connection",
"errorAtServerUnreachable" : "Unable to connect to the atServer, make sure you have a stable internet connection",
"errorAtSignAlreadyPaired" : "The atSign {atsign} is already paired, please contact support",
"errorAtSignNotExist" : "The atSign you have requested, doesn't exist in this root domain",
"errorAtSignUnavailable" : "The atSign is unavailable. Make sure you have pressed \"Activate\" from your dashboard and have a stable internet connection.",
"errorAuthenticatinFailed" : "Authentication failed",
"errorAuthenticationTimedOut" : "Authentication timed out",
"errorOtpRequestFailed" : "Failed to request an OTP, try resending, or contact support if the issue persists",
"errorOtpVerificationFailed" : "Failed to verify the OTP with the activation server, please try again. Contact support if the issue persists",
"errorProfileLoadFailed" : "Failed to load this profile, please refresh manually:",
"errorRootDomainNotSupported" : "The specified root domain is not supported by automatic activation.",
"errorSwitchAtSignFailed" : "Failed to switch atSigns after activation",
"europe" : "Europe",
"export" : "Export",
"exportLogs" : "Export Logs",
Expand All @@ -53,6 +74,8 @@
"noName" : "No Name",
"noPorts" : "NoPorts",
"onboard" : "Onboard",
"onboardingButtonStatusPicking" : "Waiting for file to be picked",
"onboardingButtonStatusProcessingFile" : "Processing file",
"onboardingError" : "An error has occurred",
"onboardingSubTitle" : "to NoPorts Desktop",
"onboardingTitle" : "Welcome",
Expand All @@ -64,12 +87,13 @@
"profileExportDialogTitle" : "Choose Filetype",
"profileExportMessage" : "What filetype would you like to export as?",
"profileExportSelectedMessage" : "What filetype would you like to export selected profiles as?",
"profileFailedLoaded" : "Failed to load",
"profileFailedLoaded" : "Profile failed to load",
"profileFailedSaveMessage": "Profile failed to save",
"profileFailedUnknownMessage" : "No reason provided",
"profileName" : "Profile Name",
"profileNameDescription" : "This will be the name of your configurations",
"profileRunningActionDeniedMessage" : "Cannot perform this action while profile is running",
"profilesFailedLoaded" : "Profiles failed to load",
"profileStatusFailedLoad": "Failed to load",
"profileStatusFailedSave": "Failed to Save",
"profileStatusFailedStart": "Failed to start",
Expand All @@ -84,14 +108,18 @@
"refresh" : "Refresh",
"relay" : "Relay",
"relayDescription" : "Choose from our existing relays or create a new one.",
"reload" : "Reload",
"remoteHost" : "Remote Host",
"remoteHostDescription" : "",
"remotePort" : "Remote Port",
"remotePortDescription" : "",
"resendPin" : "Resend Pin",
"resetAtsign" : "Reset Atsign",
"rootDomainDefault" : "Default (Prod)",
"rootDomainDemo" : "Demo (VE)",
"selectExportFile": "Please select a file to export to:",
"selectorTitleAtsign" : "Select or type the client atSign",
"selectorTitleRootDomain" : "Select or type the root domain",
"selectRootDomain" : "Select Root Domain",
"serviceMapping" : "Service Mapping",
"settings" : "Settings",
Expand All @@ -109,27 +137,5 @@
"validationErrorLongField" : "Field must be 1-36 characters long",
"validationErrorRemoteHostField" : "Field must be partially or fully qualified hostname or an IP address",
"validationErrorRemotePortField" : "Field must be between 1-65535",
"onboardingButtonStatusPicking" : "Waiting for file to be picked",
"onboardingButtonStatusProcessingFile" : "Processing file",
"errorAtServerUnavailable": "Failed to retrieve the atserver status, make sure you have a stable internet connection",
"errorAtSignNotExist" : "The atSign you have requested, doesn't exist in this root domain",
"errorRootDomainNotSupported" : "The specified root domain is not supported by automatic activation.",
"errorSwitchAtSignFailed" : "Failed to switch atSigns after activation",
"errorAtSignUnavailable" : "The atSign is unavailable. Make sure you have pressed \"Activate\" from your dashboard and have a stable internet connection.",
"errorAtKeysInvalid" : "Invalid atKeys file detected",
"errorAtKeysUploadedMismatch" : "The atKeys file you uploaded did not match the atSign requested",
"errorAtKeysFileProcessFailed" : "Failed to process the atKeys file",
"errorAtServerUnreachable" : "Unable to connect to the atServer, make sure you have a stable internet connection",
"errorAuthenticatinFailed" : "Authentication failed",
"errorAuthenticationTimedOut" : "Authentication timed out",
"errorAtSignAlreadyPaired" : "The atSign {atsign} is already paired, please contact support",
"errorAtKeySaveFailed" : "Failed to save the atKeys file: {error}",
"errorOtpRequestFailed" : "Failed to request an OTP, try resending, or contact support if the issue persists",
"errorOtpVerificationFailed" : "Failed to verify the OTP with the activation server, please try again. Contact support if the issue persists",
"backupKeyDialogTitle" : "Please select a file to export to:",
"activationStatusPreparing" : "Preparing for activation",
"activationStatusOtpWait" : "Please enter the OTP from your email",
"activationStatusActivating" : "Activating",
"resendPin" : "Resend Pin",
"yaml" : "YAML"
}
8 changes: 7 additions & 1 deletion packages/dart/npt_flutter/lib/localization/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"connected": "Conectado",
"dashboard": "Panel de control",
"dashboardView": "Vista del panel de control",
"debugDumpLogTitle": "Desarrollo: Volcar registros a la terminal",
"defaultRelaySelection": "Selección de relé predeterminada",
"delete": "Eliminar",
"deviceAtsign": "atSign del dispositivo",
Expand Down Expand Up @@ -48,6 +49,7 @@
"errorAuthenticationTimedOut": "Se agotó el tiempo de autenticación",
"errorOtpRequestFailed": "No se pudo solicitar un código OTP. Intente de nuevo o contacte al soporte si el problema persiste.",
"errorOtpVerificationFailed": "No se pudo verificar el código OTP. Intente de nuevo o contacte al soporte si el problema persiste.",
"errorProfileLoadFailed": "No se pudo cargar este perfil, por favor recargue manualmente:",
"errorRootDomainNotSupported": "El dominio raíz especificado no es compatible con la activación automática.",
"errorSwitchAtSignFailed": "No se pudo cambiar de atSign después de la activación",
"europe": "Europa",
Expand Down Expand Up @@ -87,12 +89,13 @@
"profileExportDialogTitle": "Elegir tipo de archivo",
"profileExportMessage": "¿Qué tipo de archivo desea exportar?",
"profileExportSelectedMessage": "¿Qué tipo de archivo desea exportar para los perfiles seleccionados?",
"profileFailedLoaded": "Error al cargar",
"profileFailedLoaded": "Error al cargar el perfil",
"profileFailedSaveMessage": "Error al guardar el perfil",
"profileFailedUnknownMessage": "No se especificó ningún motivo",
"profileName": "Nombre del perfil",
"profileNameDescription": "Este será el nombre de sus configuraciones",
"profileRunningActionDeniedMessage": "No se puede realizar esta acción mientras el perfil esté en ejecución",
"profilesFailedLoaded": "Error al cargar los perfiles",
"profileStatusFailedLoad": "Error al cargar",
"profileStatusFailedSave": "Error al guardar",
"profileStatusFailedStart": "Error al iniciar",
Expand All @@ -107,6 +110,7 @@
"refresh": "Actualizar",
"relay": "Relé",
"relayDescription": "Puede elegir entre nuestros relés existentes o crear uno nuevo.",
"reload": "Recargar",
"remoteHost": "Servidor remoto",
"remoteHostDescription": "",
"remotePort": "Puerto remoto",
Expand All @@ -116,6 +120,8 @@
"rootDomainDefault": "Predeterminado (Producción)",
"rootDomainDemo": "Demostración (VE)",
"selectExportFile": "Seleccione un archivo para exportar:",
"selectorTitleAtsign": "Seleccione o ingrese el atSign del cliente",
"selectorTitleRootDomain": "Seleccione o ingrese el dominio raíz",
"selectRootDomain": "Seleccionar dominio raíz",
"serviceMapping": "Mapeo de servicios",
"settings": "Ajustes",
Expand Down
8 changes: 7 additions & 1 deletion packages/dart/npt_flutter/lib/localization/app_pt.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"connected": "Conectado",
"dashboard": "Painel de controlo",
"dashboardView": "Visualização do Painel de controlo",
"debugDumpLogTitle": "Dev: Enviar registos para o terminal",
"defaultRelaySelection": "Seleção de Relay Predefinida",
"delete": "Eliminar",
"deviceAtsign": "atSign do dispositivo",
Expand Down Expand Up @@ -48,6 +49,7 @@
"errorAuthenticationTimedOut": "Tempo limite de autenticação atingido",
"errorOtpRequestFailed": "Falha ao solicitar um OTP. Tente novamente ou contacte o suporte se o problema persistir.",
"errorOtpVerificationFailed": "Falha ao verificar o OTP com o servidor de ativação. Tente novamente. Contacte o suporte se o problema persistir.",
"errorProfileLoadFailed": "Falha ao carregar este perfil, por favor, atualize manualmente:",
"errorRootDomainNotSupported": "O domínio raiz especificado não é suportado pela ativação automática.",
"errorSwitchAtSignFailed": "Falha ao mudar de atSign após a ativação",
"europe": "Europa",
Expand Down Expand Up @@ -87,12 +89,13 @@
"profileExportDialogTitle": "Escolha o tipo de ficheiro",
"profileExportMessage": "Que tipo de ficheiro pretende exportar?",
"profileExportSelectedMessage": "Que tipo de ficheiro pretende exportar os perfis selecionados?",
"profileFailedLoaded": "Falha ao carregar",
"profileFailedLoaded": "Falha ao carregar o perfil",
"profileFailedSaveMessage": "Falha ao guardar o perfil",
"profileFailedUnknownMessage": "Razão não fornecida",
"profileName": "Nome do Perfil",
"profileNameDescription": "Este será o nome das suas configurações",
"profileRunningActionDeniedMessage": "Não é possível realizar esta ação enquanto o perfil estiver em execução",
"profilesFailedLoaded": "Falha ao carregar os perfis",
"profileStatusFailedLoad": "Falha ao carregar",
"profileStatusFailedSave": "Falha ao guardar",
"profileStatusFailedStart": "Falha ao iniciar",
Expand All @@ -107,6 +110,7 @@
"refresh": "Atualizar",
"relay": "Relay",
"relayDescription": "Pode escolher entre os nossos relays existentes ou criar um novo.",
"reload": "Recarregar",
"remoteHost": "Servidor Remoto",
"remoteHostDescription": "",
"remotePort": "Porta Remota",
Expand All @@ -116,6 +120,8 @@
"rootDomainDefault": "Predefinido (Produção)",
"rootDomainDemo": "Demo (VE)",
"selectExportFile": "Selecione um ficheiro para exportar:",
"selectorTitleAtsign": "Selecione ou escreva o atSign do cliente",
"selectorTitleRootDomain": "Selecione ou escreva o domínio raiz",
"selectRootDomain": "Selecione o Domínio Raiz",
"serviceMapping": "Mapeamento de Serviço",
"settings": "Definições",
Expand Down
Loading

0 comments on commit 1b7774d

Please sign in to comment.