Skip to content

Commit 11a27c2

Browse files
Merge pull request #156 from appdevforall/chore/externalize-strings-adfa4537
ADFA-4537: externalize hardcoded user-facing strings
2 parents 71034bf + 37a4655 commit 11a27c2

14 files changed

Lines changed: 92 additions & 14 deletions

File tree

‎controller/app/src/main/java/org/iiab/controller/AdbPairingReceiver.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void onReceive(Context context, Intent intent) {
5151
performNativePairing(context.getApplicationContext(), hostIp, pairingPort, pin);
5252

5353
} else {
54-
Toast.makeText(context, "Invalid PIN length. Must be 6 digits.", Toast.LENGTH_LONG).show();
54+
Toast.makeText(context, context.getString(R.string.adb_invalid_pin_length), Toast.LENGTH_LONG).show();
5555
}
5656
}
5757
}

‎controller/app/src/main/java/org/iiab/controller/DeployFragment.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ private void checkAndHandleSyncFragmentFocus() {
546546
android.content.SharedPreferences adbPrefs = requireContext().getSharedPreferences("iiab_adb_prefs", Context.MODE_PRIVATE);
547547
if (adbPrefs.getBoolean("pairing_just_succeeded", false)) {
548548
adbPrefs.edit().putBoolean("pairing_just_succeeded", false).apply();
549-
btnAdbAction.setText("Securing connection...");
549+
btnAdbAction.setText(R.string.securing_connection);
550550
new Handler(Looper.getMainLooper()).postDelayed(() -> adbShareController.startAdbPairingFlow(true), 2500);
551551
}
552552
if (adbPrefs.getBoolean("focus_adb", false)) {

‎controller/app/src/main/java/org/iiab/controller/TerminalController.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public void openFullTerminal() {
195195
new androidx.appcompat.app.AlertDialog.Builder(activity)
196196
.setTitle(R.string.terminal_crash_title)
197197
.setMessage(android.util.Log.getStackTraceString(t))
198-
.setPositiveButton("OK", null)
198+
.setPositiveButton(android.R.string.ok, null)
199199
.show();
200200
}
201201
}

‎controller/app/src/main/java/org/iiab/controller/install/presentation/PlannerController.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public void onCalculated(InstallationPlanner.StorageProjection projection) {
376376
txtLegendFree.setText(String.format(java.util.Locale.US, "%.1fG", (freeSpaceGb - pTotal)));
377377
txtLegendFree.setTextColor(ContextCompat.getColor(fragment.requireContext(), R.color.dash_text_inverted));
378378
} else {
379-
txtLegendFree.setText("OVERLOAD");
379+
txtLegendFree.setText(R.string.storage_overload);
380380
txtLegendFree.setTextColor(ContextCompat.getColor(fragment.requireContext(), R.color.status_danger));
381381
}
382382
}
@@ -410,7 +410,7 @@ public void onCalculated(InstallationPlanner.StorageProjection projection) {
410410
}
411411

412412
int centerColor = (host.getSelectedTier() == null || host.isStorageSafe()) ? ContextCompat.getColor(fragment.requireContext(), R.color.dash_text_inverted) : ContextCompat.getColor(fragment.requireContext(), R.color.status_danger);
413-
storageGauge.updateData(segments, String.format(java.util.Locale.US, "%.1fG", pTotal), centerColor, "Projected", "Storage");
413+
storageGauge.updateData(segments, String.format(java.util.Locale.US, "%.1fG", pTotal), centerColor, fragment.getString(R.string.gauge_projected), fragment.getString(R.string.gauge_storage));
414414
}
415415

416416
if (fragment.getActivity() != null)
@@ -419,7 +419,7 @@ public void onCalculated(InstallationPlanner.StorageProjection projection) {
419419

420420
@Override
421421
public void onError(String error) {
422-
if (fragment.isAdded() && txtLegendFree != null) txtLegendFree.setText("Error");
422+
if (fragment.isAdded() && txtLegendFree != null) txtLegendFree.setText(R.string.gauge_error);
423423
}
424424
});
425425
}

‎controller/app/src/main/java/org/iiab/controller/sync/presentation/ReceiveController.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public void renderTransfer(SyncTransferState st) {
243243
progressBarTransfer.setIndeterminate(false);
244244
progressBarTransfer.setProgress(st.percent);
245245
txtTransferSpeed.setText(st.speed);
246-
txtTransferEta.setText("ETA: " + st.eta);
246+
txtTransferEta.setText(fragment.getString(R.string.sync_transfer_eta, st.eta));
247247
if (!st.file.isEmpty()) {
248248
String displayFile = st.file.length() > 40 ? "..." + st.file.substring(st.file.length() - 40) : st.file;
249249
txtTransferFilename.setText(fragment.getString(R.string.sync_transfer_filename, displayFile));

‎controller/app/src/main/res/layout/fragment_dashboard.xml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
<TextView
125125
android:layout_width="wrap_content"
126126
android:layout_height="wrap_content"
127-
android:text="Wi-Fi"
127+
android:text="@string/wifi"
128128
android:textColor="@color/text_secondary"
129129
android:textSize="13sp"
130130
android:layout_toEndOf="@id/ic_wifi"
@@ -161,7 +161,7 @@
161161
<TextView
162162
android:layout_width="wrap_content"
163163
android:layout_height="wrap_content"
164-
android:text="Hotspot"
164+
android:text="@string/hotspot"
165165
android:textColor="@color/text_secondary"
166166
android:textSize="13sp"
167167
android:layout_toEndOf="@id/ic_hotspot"
@@ -199,7 +199,7 @@
199199
<TextView
200200
android:layout_width="wrap_content"
201201
android:layout_height="wrap_content"
202-
android:text="Uptime:"
202+
android:text="@string/uptime_label"
203203
android:textColor="@color/text_secondary"
204204
android:textSize="13sp"
205205
android:layout_marginStart="6dp"

‎controller/app/src/main/res/layout/fragment_usage.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
android:id="@+id/btn_server_control"
115115
android:layout_width="match_parent"
116116
android:layout_height="90dp"
117-
android:text="Launch Server"
117+
android:text="@string/launch_server"
118118
android:textSize="20sp"
119119
android:textStyle="bold"
120120
android:textColor="@color/text_on_accent"

‎controller/app/src/main/res/layout/main.xml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
android:layout_height="48dp"
4343
android:background="?android:attr/selectableItemBackgroundBorderless"
4444
android:src="@drawable/ic_center_focus_strong"
45-
android:contentDescription="Share via QR"
45+
android:contentDescription="@string/cd_share_via_qr"
4646
android:padding="12dp"
4747
android:scaleType="fitCenter"
4848
android:tint="#FFFFFF" />
@@ -57,7 +57,7 @@
5757
android:layout_height="match_parent"
5858
android:background="?android:attr/selectableItemBackgroundBorderless"
5959
android:src="@drawable/ic_menu_preferences"
60-
android:contentDescription="Settings"
60+
android:contentDescription="@string/cd_settings"
6161
android:padding="12dp"
6262
android:scaleType="fitCenter"
6363
android:tint="#FFFFFF" />
@@ -69,7 +69,7 @@
6969
android:layout_height="48dp"
7070
android:background="?android:attr/selectableItemBackgroundBorderless"
7171
android:src="@drawable/ic_theme_system"
72-
android:contentDescription="Toggle Theme"
72+
android:contentDescription="@string/cd_toggle_theme"
7373
android:padding="12dp"
7474
android:scaleType="fitCenter"
7575
android:tint="#FFFFFF" />

‎controller/app/src/main/res/values-es/strings.xml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,4 +570,17 @@
570570
<string name="setup_dns_hint">DNS personalizado para el servidor.</string>
571571
<string name="tooltip_see_more">Ver más</string>
572572
<string name="tooltip_help_unavailable">El contenido de ayuda aún no está instalado.</string>
573+
574+
<!-- ADFA-4537: externalized strings -->
575+
<string name="adb_invalid_pin_length">Longitud de PIN inválida. Debe tener 6 dígitos.</string>
576+
<string name="securing_connection">Asegurando la conexión…</string>
577+
<string name="storage_overload">SOBRECARGA</string>
578+
<string name="gauge_projected">Proyectado</string>
579+
<string name="gauge_storage">Almacenamiento</string>
580+
<string name="gauge_error">Error</string>
581+
<string name="sync_transfer_eta">ETA: %1$s</string>
582+
<string name="cd_share_via_qr">Compartir por QR</string>
583+
<string name="cd_settings">Ajustes</string>
584+
<string name="cd_toggle_theme">Cambiar tema</string>
585+
<string name="uptime_label">Tiempo activo:</string>
573586
</resources>

‎controller/app/src/main/res/values-fr/strings.xml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,4 +571,17 @@
571571
<string name="setup_dns_hint">DNS personnalisé pour le serveur.</string>
572572
<string name="tooltip_see_more">Voir plus</string>
573573
<string name="tooltip_help_unavailable">Le contenu d\'aide n\'est pas encore installé.</string>
574+
575+
<!-- ADFA-4537: externalized strings -->
576+
<string name="adb_invalid_pin_length">Longueur de code PIN invalide. Doit comporter 6 chiffres.</string>
577+
<string name="securing_connection">Sécurisation de la connexion…</string>
578+
<string name="storage_overload">SURCHARGE</string>
579+
<string name="gauge_projected">Projeté</string>
580+
<string name="gauge_storage">Stockage</string>
581+
<string name="gauge_error">Erreur</string>
582+
<string name="sync_transfer_eta">ETA : %1$s</string>
583+
<string name="cd_share_via_qr">Partager via QR</string>
584+
<string name="cd_settings">Paramètres</string>
585+
<string name="cd_toggle_theme">Changer de thème</string>
586+
<string name="uptime_label">Temps de fonctionnement :</string>
574587
</resources>

0 commit comments

Comments
 (0)