{ "id": "api/localize/init/LocalizeFn", "title": "LocalizeFn", "contents": "\n\n
\n
\n
\n \n API > @angular/localize > @angular/localize/init\n
\n \n
\n \n
\n

LocalizeFnlink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n \n \n
\n \n \n
\n\ninterface LocalizeFn {\n translate?: TranslateFn\n locale?: string\n (messageParts: TemplateStringsArray, ...expressions: readonly any[]): string\n}\n\n\n \n \n\n\n \n \n\n
\n\n \n\n \n \n \n
\n

Propertieslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
PropertyDescription
\n \n translate?: TranslateFn\n \n \n

A function that converts an input \"message with expressions\" into a translated \"message with\nexpressions\".

\n\n

The conversion may be done in place, modifying the array passed to the function, so\ndon't assume that this has no side-effects.

\n

The expressions must be passed in since it might be they need to be reordered for\ndifferent translations.

\n\n
\n \n locale?: string\n \n \n

The current locale of the translated messages.

\n\n

The compile-time translation inliner is able to replace the following code:

\n\ntypeof $localize !== \"undefined\" && $localize.locale\n\n

with a string literal of the current locale. E.g.

\n\n\"fr\"\n\n\n
\n
\n \n\n
\n

Methodslink

\n \n \n\n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n call signature\n \n link

\n \n
\n
\n
\n \n\n (messageParts: TemplateStringsArray, ...expressions: readonly any[]): string\n\n \n\n
Parameters
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n messageParts\n TemplateStringsArray\n \n \n
\n \n expressions\n readonly any[]\n \n \n
\n\n \n
Returns
\n

string

\n\n \n\n\n \n\n \n
\n
\n\n \n
\n\n\n \n\n\n
\n
\n\n\n" }