wantedly / hi18n

message internationalization meets immutability and type-safety

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initialize locale in Catalog

qnighy opened this issue · comments

Why

Currently Catalog#locale is initialized in Book using the key given:

export const book = new Book<Vocabulary>({
  // catalogEn.locale is set to "en"
  en: catalogEn,
});

This breaks immutability and makes it difficult to figure out what locale the catalog is used for.

What

Initialize locale in Catalog.

I think the locale should be in the first argument, and the user should not omit it. Therefore the original API should be deprecated and removed in 0.2.0.