You can dynamically change parameters and expressions values as with pipes, but not in attributes.
The following features can be customized. You just have to implement the indicated class-interface and pass the token during configuration.
E.g.
@Injectable() export class HttpTranslationLoader implements L10nTranslationLoader {
@@ -346,9 +357,9 @@ Validation
L10nFormat
: shows the format of the language to be used for translations. The supported formats are: 'language' | 'language-script' | 'language-region' | 'language-script-region'
. So, for example, you can have a language like en-US-u-ca-gregory-nu-latn
to format dates and numbers, but only use the en-US
for translations setting 'language-region'
-L10nDateTimeFormatOptions
: the type of options used to format dates. Extends the Intl DateTimeFormatOptions
interface, adding the dateStyle and timeStyle attributes
+L10nDateTimeFormatOptions
: the type of options used to format dates. Extends the Intl DateTimeFormatOptions
interface, adding the dateStyle and timeStyle attributes. See DateTimeFormat for more details on available options
-L10nNumberFormatOptions
: the type of options used to format numbers. Extends the Intl NumberFormatOptions
interface, adding the digits attribute
+L10nNumberFormatOptions
: the type of options used to format numbers. Extends the Intl NumberFormatOptions
interface, adding the digits attribute. See NumberFormat for more details on available options
Intl API
@@ -357,20 +368,23 @@ Intl API
-All modern browsers have implemented this API. You can use a polyfill like Polyfill.io to extend support to old browsers.
-Just add one script tag in your index.html
:
-<script crossorigin="anonymous"
- src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=Intl.~locale.en-US"></script>
When specifying the features
, you have to specify what languages to load.
-Other polyfills:
+You can use polyfills to extend support to old browsers, or to use newest features:
-- Format.JS
+Polyfill.io
+ Just add one script tag in your index.html
, for example:
+ <script crossorigin="anonymous"
+ src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=Intl.~locale.en-US"></script>
When specifying the features
, you have to specify what languages to load
+
+Format.JS
+ Import polyfills you need as in the sample app
+
-The L10nIntlService
also provides methods for other APIs, such as Collator, PluralRules and ListFormat.
Intl API in Node.js
To use Intl in Node.js, check the support according to the version in the official documentation: Internationalization Support
Server Side Rendering
-You can find a complete sample app with @nguniversal/express-engine here.
+You can find a complete sample app with @nguniversal/express-engine here
SSR doesn't work out of the box, so it is important to know:
src\app\universal-interceptor.ts
: used to handle absolute URLs for HTTP requests on the server
@@ -382,6 +396,11 @@ Server Side Rendering
Previous versions