Skip to content

Commit b1ab08b

Browse files
committed
chore(i18n): rename getI18nBundles to getDefaultI18nBundles and update imports; add default language documentation
1 parent 2b6949c commit b1ab08b

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

packages/i18n/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ export type {I18nBundle, I18nTranslations, I18nMetadata, I18nTextDirection} from
2323
export * from './translations';
2424

2525
// Utils
26-
export {default as getI18nBundles} from './utils/getI18nBundles';
26+
export {default as getDefaultI18nBundles} from './utils/getDefaultI18nBundles';

packages/i18n/src/translations/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@
1616
* under the License.
1717
*/
1818

19+
// IMPORTANT: Only include default bundled languages here.
20+
// Current List:
21+
// 1. en-US
22+
1923
export {default as en_US} from './en-US';

packages/i18n/src/utils/getI18nBundles.ts renamed to packages/i18n/src/utils/getDefaultI18nBundles.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@
1616
* under the License.
1717
*/
1818

19-
import {I18nBundle, I18nTranslations} from '../models/i18n';
2019
import * as i18n from '../translations';
2120

2221
/**
23-
* Get internationalization bundles for the specified locale.
22+
* Get the default i18n bundles.
2423
*
2524
* @param locale - The locale to get the bundle for (defaults to 'en-US')
2625
* @returns The i18n bundle for the specified locale
2726
*/
28-
const getI18nBundles = () => {
27+
const getDefaultI18nBundles = () => {
2928
return i18n;
3029
};
3130

32-
export default getI18nBundles;
31+
export default getDefaultI18nBundles;

packages/react/src/contexts/I18n/I18nProvider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818

1919
import {FC, PropsWithChildren, ReactElement, useCallback, useEffect, useMemo, useState} from 'react';
20-
import {I18nBundle, getI18nBundles} from '@asgardeo/i18n';
20+
import {I18nBundle, getDefaultI18nBundles} from '@asgardeo/i18n';
2121
import {deepMerge, I18nPreferences} from '@asgardeo/browser';
2222
import I18nContext, {I18nContextValue} from './I18nContext';
2323

@@ -78,7 +78,7 @@ const I18nProvider: FC<PropsWithChildren<I18nProviderProps>> = ({
7878
preferences,
7979
}: PropsWithChildren<I18nProviderProps>): ReactElement => {
8080
// Get default bundles from the browser package
81-
const defaultBundles = getI18nBundles();
81+
const defaultBundles = getDefaultI18nBundles();
8282

8383
// Determine the initial language based on preference order:
8484
// 1. User preference from config

0 commit comments

Comments
 (0)