For date (and cxDate) pipe to work in the language other than en, we need to import and register locale data from @angular/common/locales/<localeId> in the shell app. For example:
import localeDe from '@angular/common/locales/de';
import localeJa from '@angular/common/locales/ja';
import localeZh from '@angular/common/locales/zh';
registerLocaleData(localeDe);
registerLocaleData(localeJa);
registerLocaleData(localeZh);
The drawbacks of such a solution are:
bloating shell app code
data for all locales are bundled into JS of the shell app
Maybe we can leverage the dynamic imports in the shell app for lazy loading. But it will require in tsconfig "module": "commonjs". The final solution have to also work in SSR.
Hey @Platonn , any improvements on this? We're rolling out an international shop and try to find a dynamic solution to include/load the different languages (and date formats)
For
date
(andcxDate
) pipe to work in the language other thanen
, we need to import and register locale data from@angular/common/locales/<localeId>
in the shell app. For example:The drawbacks of such a solution are:
Maybe we can leverage the dynamic imports in the shell app for lazy loading. But it will require in tsconfig
"module": "commonjs"
. The final solution have to also work in SSR.