Make strings translatable

This commit is contained in:
Marvin W 2022-01-25 18:31:24 +01:00
parent f3c20333b0
commit 0497f7ead3
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
2 changed files with 11 additions and 5 deletions

View File

@ -91,20 +91,20 @@ class DeviceRegistrationPreferencesFragment : PreferenceFragmentCompat() {
val configuredProfile = ProfileManager.getConfiguredProfile(context)
val autoProfile = ProfileManager.getAutoProfile(context)
val autoProfileName = when (autoProfile) {
PROFILE_NATIVE -> "Native"
PROFILE_REAL -> "Real"
PROFILE_NATIVE -> getString(R.string.profile_name_native)
PROFILE_REAL -> getString(R.string.profile_name_real)
else -> ProfileManager.getProfileName(context, autoProfile)
}
val profiles =
mutableListOf(PROFILE_AUTO, PROFILE_NATIVE, PROFILE_REAL)
val profileNames = mutableListOf("Automatic: $autoProfileName", "Native", "Real")
val profileNames = mutableListOf(getString(R.string.profile_name_auto, autoProfileName), getString(R.string.profile_name_native), getString(R.string.profile_name_real))
if (ProfileManager.hasProfile(context, PROFILE_SYSTEM)) {
profiles.add(PROFILE_SYSTEM)
profileNames.add("System: ${ProfileManager.getProfileName(context, PROFILE_SYSTEM)}")
profileNames.add(getString(R.string.profile_name_system, ProfileManager.getProfileName(context, PROFILE_SYSTEM)))
}
if (ProfileManager.hasProfile(context, PROFILE_USER)) {
profiles.add(PROFILE_USER)
profileNames.add("Custom: ${ProfileManager.getProfileName(context, PROFILE_USER)}")
profileNames.add(getString(R.string.profile_name_user, ProfileManager.getProfileName(context, PROFILE_USER)))
}
for (profile in R.xml::class.java.declaredFields.map { it.name }
.filter { it.startsWith("profile_") }

View File

@ -181,4 +181,10 @@ This can take a couple of minutes."</string>
<string name="pref_test_summary_running">Running…</string>
<string name="pref_droidguard_operation_mode">Operation mode</string>
<string name="profile_name_native">Native</string>
<string name="profile_name_real">Real</string>
<string name="profile_name_user">Custom: %s</string>
<string name="profile_name_auto">Automatic: %s</string>
<string name="profile_name_system">System: %s</string>
</resources>