Skip to content

Commit

Permalink
Make strings translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
mar-v-in committed Jan 25, 2022
1 parent f3c2033 commit 0497f7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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_") }
Expand Down
6 changes: 6 additions & 0 deletions play-services-core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

1 comment on commit 0497f7e

@rehork
Copy link
Contributor

@rehork rehork commented on 0497f7e Apr 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I'd like to add polish translation to your project. It hasn't been updated for a very long time. What is to best way to provide you translations?

Please sign in to comment.