Skip to content

Commit

Permalink
i18n [nfc]: s/messages/messagesByLanguage
Browse files Browse the repository at this point in the history
This explicitness will help us avoid a shadowed variable soon.
  • Loading branch information
chrisbobbe authored and gnprice committed Apr 26, 2024
1 parent 67c2655 commit 4bbf876
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/boot/TranslationProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { IntlShape } from 'react-intl';
import type { GetText } from '../types';
import { useGlobalSelector } from '../react-redux';
import { getGlobalSettings } from '../selectors';
import messages from '../i18n/messages';
import messagesByLanguage from '../i18n/messagesByLanguage';

// $FlowFixMe[incompatible-type] could put a well-typed mock value here, to help write tests
export const TranslationContext: React.Context<GetText> = React.createContext(undefined);
Expand Down Expand Up @@ -58,7 +58,7 @@ export default function TranslationProvider(props: Props): React.Node {
const language = useGlobalSelector(state => getGlobalSettings(state).language);

return (
<IntlProvider locale={language} textComponent={Text} messages={messages[language]}>
<IntlProvider locale={language} textComponent={Text} messages={messagesByLanguage[language]}>
<TranslationContextTranslator>{children}</TranslationContextTranslator>
</IntlProvider>
);
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/settings/languages.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* @flow strict-local */
import messages from '../i18n/messages';
import messagesByLanguage from '../i18n/messagesByLanguage';

export type Language = {|
tag: $Keys<typeof messages>,
tag: $Keys<typeof messagesByLanguage>,
name: string,
selfname: string,
|};
Expand Down

0 comments on commit 4bbf876

Please sign in to comment.