Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{/*
Use the form below to see FBT in action.
*/}
<form method="get" action="">
<fieldset>
<span>
<span>
<select>) => {
const vcGender = parseInt(event.target.value, 10);
IntlViewerContext.GENDER = vcGender;
this.forceUpdate();
}}>
<option value="{IntlVariations.GENDER_UNKNOWN}">
Your Gender:
</option>
<option value="{IntlVariations.GENDER_MALE}">Female</option>
<option value="{IntlVariations.GENDER_FEMALE}">Male</option>
<option value="{IntlVariations.GENDER_UNKNOWN}">
Unknown
</option>
</select>
</span>
</span>
</fieldset>
<fieldset>
<span>
<span></span></span></fieldset></form>
it('should pass when used properly', () => {
fbt.param('age', 18);
fbt.param('age', 18, {});
fbt.param('age', 18, { number: true });
fbt.param('age', 18, { number: 1 });
fbt.param('age', 18, { gender: IntlVariations.GENDER_UNKNOWN });
fbt.param('age', 18, { gender: IntlVariations.GENDER_FEMALE });
});
it('should pass when used properly', () => {
const fbtResult = fbt('text', 'desc');
const s: string = fbtResult + '';
const s2: string = fbtResult.toString();
fbt('text', 'desc', {});
fbt('text', 'desc', {
subject: IntlVariations.GENDER_UNKNOWN,
author: 'murAmur',
project: 'flow-typed',
preserveWhitespace: false,
common: false,
doNotExtract: false,
});
});
Use the form below to see FBT in action.
<form method="get" action="">
<fieldset>
<span>
<span>
<select>) => {
const vcGender = parseInt(event.target.value, 10);
IntlViewerContext.GENDER = vcGender;
this.forceUpdate();
}}>
<option value="{IntlVariations.GENDER_UNKNOWN}">
Your Gender:
</option>
<option value="{IntlVariations.GENDER_UNKNOWN}">
Unknown
</option>
<option value="{IntlVariations.GENDER_MALE}">
Male
</option>
<option value="{IntlVariations.GENDER_FEMALE}">
Female
</option>
</select>
</span>
</span>
</fieldset>
</form>
type State = {|
locale: Locale,
vcGender: Variation,
ex1Name: string,
ex1Gender: Variation,
ex1Count: int,
ex2Name: string,
ex2Object: SharedObj,
ex2Pronoun: PronounGender,
|};
export default class Example extends React.Component {
state = {
locale: 'en_US',
ex1Name: 'Someone',
ex1Gender: IntlVariations.GENDER_UNKNOWN,
ex1Count: 1,
ex2Name: 'Someone',
ex2Object: 'LINK',
ex2Pronoun: GenderConst.UNKNOWN_SINGULAR,
};
setLocale(locale: Locale) {
IntlViewerContext.locale = locale;
this.setState({locale});
const html = document.getElementsByTagName('html')[0];
if (html != null) {
html.lang = LOCALES[locale].bcp47;
}
document.body.className = LOCALES[locale].rtl ? 'rtl' : 'ltr';
}
type State = {|
locale: Locale,
vcGender: Variation,
ex1Name: string,
ex1Gender: Variation,
ex1Count: int,
ex2Name: string,
ex2Object: SharedObj,
ex2Pronoun: PronounGender,
|};
export default class Example extends React.Component {
state = {
locale: 'en_US',
ex1Name: 'Someone',
ex1Gender: IntlVariations.GENDER_UNKNOWN,
ex1Count: 1,
ex2Name: 'Someone',
ex2Object: 'LINK',
ex2Pronoun: GenderConst.UNKNOWN_SINGULAR,
};
setLocale(locale: Locale) {
IntlViewerContext.locale = locale;
this.setState({locale});
const html = document.getElementsByTagName('html')[0];
if (html != null) {
html.lang = LOCALES[locale].bcp47;
}
document.body.className = LOCALES[locale].rtl ? 'rtl' : 'ltr';
}