Skip to content

Commit ee31644

Browse files
committed
refactor: locale string as param0
1 parent 72396da commit ee31644

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

packages/core/src/compile-module.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,7 @@ describe('compileModule()', function () {
248248
const phone = {
249249
formatter: () => '',
250250
id: 'phone',
251-
module: ({ locale }: { locale: string }) => {
252-
return `phone/${locale}`;
253-
}
251+
module: locale => `phone/${locale}`
254252
};
255253
const mf = new MessageFormat('en', { customFormatters: { phone } });
256254
const msg = '{foo, phone}';
@@ -262,7 +260,7 @@ describe('compileModule()', function () {
262260
const phone = {
263261
formatter: (_: unknown) => '',
264262
id: 'phone',
265-
module: ({ locale }: { locale: string }) => `phone/${locale}`
263+
module: locale => `phone/${locale}`
266264
};
267265
const mf = new MessageFormat(['en-US', 'fr-FR'], {
268266
customFormatters: { phone },

packages/core/src/compiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export default class Compiler {
323323
id: identifier(cf.id),
324324
module:
325325
typeof cf.module === 'function'
326-
? cf.module({ locale: this.plural.locale })
326+
? cf.module(this.plural.locale)
327327
: cf.module
328328
}
329329
: { id: null, module: null }

packages/core/src/messageformat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export interface MessageFormatOptions<
9797
formatter: LocaleModuleCustomFormatter;
9898
arg?: 'string' | 'raw' | 'options';
9999
id?: string;
100-
module?: (_: { locale: string }) => string;
100+
module?: (locale: string) => string;
101101
};
102102
};
103103

0 commit comments

Comments
 (0)