mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: remove i18n toggle (#69389)
* remove i18n toggle
* remove beta badge on language picker
* remove toggle from go code
* Revert "remove beta badge on language picker"
This reverts commit 3b76300aa7
.
This commit is contained in:
parent
914d1a94ba
commit
5a98348faf
@ -25,7 +25,6 @@ Some stable features are enabled by default. You can disable a stable feature by
|
||||
| `featureHighlights` | Highlight Grafana Enterprise features | |
|
||||
| `exploreMixedDatasource` | Enable mixed datasource in Explore | Yes |
|
||||
| `dataConnectionsConsole` | Enables a new top-level page called Connections. This page is an experiment that provides a better experience when you install and configure data sources and other plugins. | Yes |
|
||||
| `internationalization` | Enables internationalization | Yes |
|
||||
| `topnav` | Enables new top navigation and page layouts | Yes |
|
||||
| `cloudWatchCrossAccountQuerying` | Enables cross-account querying in CloudWatch datasources | Yes |
|
||||
| `newPanelChromeUI` | Show updated look and feel of grafana-ui PanelChrome: panel header, icons, and menu | Yes |
|
||||
|
@ -45,7 +45,6 @@ export interface FeatureToggles {
|
||||
disableSecretsCompatibility?: boolean;
|
||||
logRequestsInstrumentedAsUnknown?: boolean;
|
||||
dataConnectionsConsole?: boolean;
|
||||
internationalization?: boolean;
|
||||
topnav?: boolean;
|
||||
grpcServer?: boolean;
|
||||
entityStore?: boolean;
|
||||
|
@ -49,7 +49,7 @@ func (hs *HTTPServer) setIndexViewData(c *contextmodel.ReqContext) (*dtos.IndexV
|
||||
locale := "en-US"
|
||||
language := "" // frontend will set the default language
|
||||
|
||||
if hs.Features.IsEnabled(featuremgmt.FlagInternationalization) && prefs.JSONData.Language != "" {
|
||||
if prefs.JSONData.Language != "" {
|
||||
language = prefs.JSONData.Language
|
||||
}
|
||||
|
||||
|
@ -186,13 +186,6 @@ var (
|
||||
Expression: "true", // turned on by default
|
||||
Owner: grafanaPluginsPlatformSquad,
|
||||
},
|
||||
{
|
||||
Name: "internationalization",
|
||||
Description: "Enables internationalization",
|
||||
State: FeatureStateStable,
|
||||
Expression: "true", // enabled by default
|
||||
Owner: grafanaUserEssentialsSquad,
|
||||
},
|
||||
{
|
||||
Name: "topnav",
|
||||
Description: "Enables new top navigation and page layouts",
|
||||
|
@ -26,7 +26,6 @@ scenes,alpha,@grafana/dashboards-squad,false,false,false,true
|
||||
disableSecretsCompatibility,alpha,@grafana/hosted-grafana-team,false,false,true,false
|
||||
logRequestsInstrumentedAsUnknown,alpha,@grafana/hosted-grafana-team,false,false,false,false
|
||||
dataConnectionsConsole,stable,@grafana/plugins-platform-backend,false,false,false,false
|
||||
internationalization,stable,@grafana/user-essentials,false,false,false,false
|
||||
topnav,stable,@grafana/user-essentials,false,false,false,false
|
||||
grpcServer,beta,@grafana/grafana-app-platform-squad,false,false,false,false
|
||||
entityStore,alpha,@grafana/grafana-app-platform-squad,true,false,false,false
|
||||
|
|
@ -115,10 +115,6 @@ const (
|
||||
// Enables a new top-level page called Connections. This page is an experiment that provides a better experience when you install and configure data sources and other plugins.
|
||||
FlagDataConnectionsConsole = "dataConnectionsConsole"
|
||||
|
||||
// FlagInternationalization
|
||||
// Enables internationalization
|
||||
FlagInternationalization = "internationalization"
|
||||
|
||||
// FlagTopnav
|
||||
// Enables new top navigation and page layouts
|
||||
FlagTopnav = "topnav"
|
||||
|
@ -224,10 +224,7 @@ func (s *Service) GetDefaults() *pref.Preference {
|
||||
HomeDashboardID: 0,
|
||||
JSONData: &pref.PreferenceJSONData{},
|
||||
}
|
||||
|
||||
if s.features.IsEnabled(featuremgmt.FlagInternationalization) {
|
||||
defaults.JSONData.Language = s.cfg.DefaultLanguage
|
||||
}
|
||||
defaults.JSONData.Language = s.cfg.DefaultLanguage
|
||||
|
||||
return defaults
|
||||
}
|
||||
|
@ -45,7 +45,9 @@ func TestGetDefaults(t *testing.T) {
|
||||
Theme: "light",
|
||||
Timezone: "UTC",
|
||||
HomeDashboardID: 0,
|
||||
JSONData: &pref.PreferenceJSONData{},
|
||||
JSONData: &pref.PreferenceJSONData{
|
||||
Language: "en-US",
|
||||
},
|
||||
}
|
||||
if diff := cmp.Diff(expected, preference); diff != "" {
|
||||
t.Fatalf("Result mismatch (-want +got):\n%s", diff)
|
||||
@ -56,32 +58,6 @@ func TestGetDefaults(t *testing.T) {
|
||||
query := &pref.GetPreferenceWithDefaultsQuery{OrgID: 1}
|
||||
preference, err := prefService.GetWithDefaults(context.Background(), query)
|
||||
require.NoError(t, err)
|
||||
expected := &pref.Preference{
|
||||
WeekStart: &weekStart,
|
||||
Theme: "light",
|
||||
Timezone: "UTC",
|
||||
HomeDashboardID: 0,
|
||||
JSONData: &pref.PreferenceJSONData{},
|
||||
}
|
||||
if diff := cmp.Diff(expected, preference); diff != "" {
|
||||
t.Fatalf("Result mismatch (-want +got):\n%s", diff)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetDefaultsWithI18nFeatureFlag(t *testing.T) {
|
||||
prefService := &Service{
|
||||
store: newFake(),
|
||||
cfg: setting.NewCfg(),
|
||||
features: featuremgmt.WithFeatures(featuremgmt.FlagInternationalization),
|
||||
}
|
||||
weekStart := ""
|
||||
prefService.cfg.DefaultLanguage = "en-US"
|
||||
prefService.cfg.DefaultTheme = "light"
|
||||
prefService.cfg.DateFormats.DefaultTimezone = "UTC"
|
||||
|
||||
t.Run("GetDefaults", func(t *testing.T) {
|
||||
preference := prefService.GetDefaults()
|
||||
expected := &pref.Preference{
|
||||
WeekStart: &weekStart,
|
||||
Theme: "light",
|
||||
|
@ -7,19 +7,6 @@ import { Preferences as UserPreferencesDTO } from '@grafana/schema/src/raw/prefe
|
||||
|
||||
import SharedPreferences from './SharedPreferences';
|
||||
|
||||
jest.mock('@grafana/runtime', () => {
|
||||
const originalModule = jest.requireActual('@grafana/runtime');
|
||||
return {
|
||||
...originalModule,
|
||||
config: {
|
||||
...originalModule.config,
|
||||
featureToggles: {
|
||||
internationalization: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('app/core/services/backend_srv', () => {
|
||||
return {
|
||||
backendSrv: {
|
||||
|
@ -49,8 +49,6 @@ function getLanguageOptions(): Array<SelectableValue<string>> {
|
||||
return options;
|
||||
}
|
||||
|
||||
const i18nFlag = Boolean(config.featureToggles.internationalization);
|
||||
|
||||
export class SharedPreferences extends PureComponent<Props, State> {
|
||||
service: PreferencesService;
|
||||
themeOptions: SelectableValue[];
|
||||
@ -195,27 +193,25 @@ export class SharedPreferences extends PureComponent<Props, State> {
|
||||
/>
|
||||
</Field>
|
||||
|
||||
{i18nFlag ? (
|
||||
<Field
|
||||
label={
|
||||
<Label htmlFor="locale-select">
|
||||
<span className={styles.labelText}>
|
||||
<Trans i18nKey="shared-preferences.fields.locale-label">Language</Trans>
|
||||
</span>
|
||||
<FeatureBadge featureState={FeatureState.beta} />
|
||||
</Label>
|
||||
}
|
||||
data-testid="User preferences language drop down"
|
||||
>
|
||||
<Select
|
||||
value={languages.find((lang) => lang.value === language)}
|
||||
onChange={(lang: SelectableValue<string>) => this.onLanguageChanged(lang.value ?? '')}
|
||||
options={languages}
|
||||
placeholder={t('shared-preferences.fields.locale-placeholder', 'Choose language')}
|
||||
inputId="locale-select"
|
||||
/>
|
||||
</Field>
|
||||
) : null}
|
||||
<Field
|
||||
label={
|
||||
<Label htmlFor="locale-select">
|
||||
<span className={styles.labelText}>
|
||||
<Trans i18nKey="shared-preferences.fields.locale-label">Language</Trans>
|
||||
</span>
|
||||
<FeatureBadge featureState={FeatureState.beta} />
|
||||
</Label>
|
||||
}
|
||||
data-testid="User preferences language drop down"
|
||||
>
|
||||
<Select
|
||||
value={languages.find((lang) => lang.value === language)}
|
||||
onChange={(lang: SelectableValue<string>) => this.onLanguageChanged(lang.value ?? '')}
|
||||
options={languages}
|
||||
placeholder={t('shared-preferences.fields.locale-placeholder', 'Choose language')}
|
||||
inputId="locale-select"
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<div className="gf-form-button-row">
|
||||
<Button
|
||||
|
@ -22,19 +22,6 @@ jest.mock('app/core/core', () => {
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('@grafana/runtime', () => {
|
||||
const originalModule = jest.requireActual('@grafana/runtime');
|
||||
return {
|
||||
...originalModule,
|
||||
config: {
|
||||
...originalModule.config,
|
||||
featureToggles: {
|
||||
internationalization: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const setup = (propOverrides?: object) => {
|
||||
jest.clearAllMocks();
|
||||
// needed because SharedPreferences is rendered in the test
|
||||
|
Loading…
Reference in New Issue
Block a user