Bug 1851691 - FeatureFlag and Debug Preferences for Translations

This patch adds a feature flag of `translations` and a debug preference
of `pref_key_enable_translations` for developing translations.

Currently, the feature flag guards the option to enable translations and
is set to debug channels. These options will slowly adjust for wider
audiences as development progresses.
fenix/119.0
Olivia Hall 9 months ago committed by mergify[bot]
parent 55da305c3f
commit a272a0d585

@ -67,4 +67,10 @@ object FeatureFlags {
* Enables the lib-state HistoryFragment refactor
*/
val historyFragmentLibStateRefactor = Config.channel.isNightlyOrDebug
/**
* Allows users to enable translations.
* Preference to fully enable translations is pref_key_enable_translations.
*/
val translations = Config.channel.isDebug
}

@ -12,6 +12,7 @@ import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.Config
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.nav
@ -64,6 +65,12 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
onPreferenceChangeListener = SharedPreferenceUpdater()
}
requirePreference<SwitchPreference>(R.string.pref_key_enable_translations).apply {
isVisible = FeatureFlags.translations
isChecked = context.settings().enableTranslations
onPreferenceChangeListener = SharedPreferenceUpdater()
}
// for performance reasons, this is only available in Nightly or Debug builds
requirePreference<EditTextPreference>(R.string.pref_key_custom_glean_server_url).apply {
isVisible = Config.channel.isNightlyOrDebug && BuildConfig.GLEAN_CUSTOM_URL.isNullOrEmpty()

@ -1814,6 +1814,14 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default = FxNimbus.features.shoppingExperience.value().enabled,
)
/**
* Indicates if Firefox translations are enabled.
*/
var enableTranslations by booleanPreference(
key = appContext.getPreferenceKey(R.string.pref_key_enable_translations),
default = false,
)
/**
* Adjust Activated User sent
*/

@ -352,6 +352,7 @@
<string name="pref_key_custom_sponsored_stories_city" translatable="false">pref_key_custom_sponsored_stories_city</string>
<string name="pref_key_enable_compose_top_sites" translatable="false">pref_key_enable_compose_top_sites</string>
<string name="pref_key_enable_shopping_experience" translatable="false">pref_key_enable_shopping_experience</string>
<string name="pref_key_enable_translations" translatable="false">pref_key_enable_translations</string>
<!-- Growth Data -->
<string name="pref_key_growth_set_as_default" translatable="false">pref_key_growth_set_as_default</string>

@ -68,6 +68,8 @@
<string name="preferences_debug_settings_compose_top_sites" translatable="false">Enable Compose Top Sites</string>
<!-- Label for enabling the shopping experience -->
<string name="preferences_debug_settings_shopping_experience" translatable="false">Enable Shopping Experience</string>
<!-- Label for enabling translations -->
<string name="preferences_debug_settings_translations" translatable="false">Enable Firefox Translations</string>
<!-- A secret menu option in the tabs tray for making a tab inactive for testing. -->
<string name="inactive_tabs_menu_item">Make inactive</string>

@ -30,6 +30,11 @@
android:key="@string/pref_key_enable_shopping_experience"
android:title="@string/preferences_debug_settings_shopping_experience"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_enable_translations"
android:title="@string/preferences_debug_settings_translations"
app:iconSpaceReserved="false" />
<EditTextPreference
android:key="@string/pref_key_custom_glean_server_url"
android:title="@string/preferences_debug_settings_custom_glean_server_url"

Loading…
Cancel
Save