Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove beta flag for i18n #15169

Merged
merged 2 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 15 additions & 29 deletions src/components/LocalePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as App from '../libs/actions/App';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import ONYXKEYS from '../ONYXKEYS';
import CONST from '../CONST';
import Permissions from '../libs/Permissions';
import * as Localize from '../libs/Localize';
import Picker from './Picker';
import styles from '../styles/styles';
Expand All @@ -19,16 +18,12 @@ const propTypes = {
/** Indicates size of a picker component and whether to render the label or not */
size: PropTypes.oneOf(['normal', 'small']),

/** Beta features list */
betas: PropTypes.arrayOf(PropTypes.string),

...withLocalizePropTypes,
};

const defaultProps = {
preferredLocale: CONST.DEFAULT_LOCALE,
size: 'normal',
betas: [],
};

const localesToLanguages = {
Expand All @@ -42,28 +37,22 @@ const localesToLanguages = {
},
};

const LocalePicker = (props) => {
if (!Permissions.canUseInternationalization(props.betas)) {
return null;
}

return (
<Picker
label={props.size === 'normal' ? props.translate('languagePage.language') : null}
onInputChange={(locale) => {
if (locale === props.preferredLocale) {
return;
}
const LocalePicker = props => (
<Picker
label={props.size === 'normal' ? props.translate('languagePage.language') : null}
onInputChange={(locale) => {
if (locale === props.preferredLocale) {
return;
}

App.setLocale(locale);
}}
items={_.values(localesToLanguages)}
size={props.size}
value={props.preferredLocale}
containerStyles={props.size === 'small' ? [styles.pickerContainerSmall] : []}
/>
);
};
App.setLocale(locale);
}}
items={_.values(localesToLanguages)}
size={props.size}
value={props.preferredLocale}
containerStyles={props.size === 'small' ? [styles.pickerContainerSmall] : []}
/>
);

LocalePicker.defaultProps = defaultProps;
LocalePicker.propTypes = propTypes;
Expand All @@ -75,8 +64,5 @@ export default compose(
preferredLocale: {
key: ONYXKEYS.NVP_PREFERRED_LOCALE,
},
betas: {
key: ONYXKEYS.BETAS,
},
}),
)(LocalePicker);
9 changes: 0 additions & 9 deletions src/libs/Permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ function canUseDefaultRooms(betas) {
return _.contains(betas, CONST.BETAS.DEFAULT_ROOMS) || canUseAllBetas(betas);
}

/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseInternationalization(betas) {
return _.contains(betas, CONST.BETAS.INTERNATIONALIZATION) || canUseAllBetas(betas);
}

/**
* @param {Array<String>} betas
* @returns {Boolean}
Expand Down Expand Up @@ -107,7 +99,6 @@ export default {
canUseIOU,
canUsePayWithExpensify,
canUseDefaultRooms,
canUseInternationalization,
canUseIOUSend,
canUseWallet,
canUseCommentLinking,
Expand Down