5 lines
7.2 KiB
JSON
5 lines
7.2 KiB
JSON
|
{
|
||
|
"id": "api/localize/init/$localize",
|
||
|
"title": "$localize",
|
||
|
"contents": "\n\n<article>\n <div class=\"breadcrumb-container\">\n <div class=\"breadcrumb\">\n <script type=\"application/ld+json\">\n {\n \"@context\": \"http://schema.org\",\n \"@type\": \"BreadcrumbList\",\n \"itemListElement\": [\n { \"@type\": \"ListItem\", \"position\": 1, \"item\": { \"@id\": \"https://angular.io//api\", \"name\": \"API\" } },\n { \"@type\": \"ListItem\", \"position\": 2, \"item\": { \"@id\": \"https://angular.io/api/localize\", \"name\": \"@angular/localize\" } },\n { \"@type\": \"ListItem\", \"position\": 3, \"item\": { \"@id\": \"https://angular.io/api/localize/init\", \"name\": \"@angular/localize/init\" } },\n { \"@type\": \"ListItem\", \"position\": 4, \"item\": { \"@id\": \"https://angular.io/api/localize/init/$localize\", \"name\": \"$localize\" } }\n ]\n }\n </script>\n <a href=\"/api\">API</a> > <a href=\"api/localize\">@angular/localize</a> > <a href=\"api/localize/init\">@angular/localize/init</a>\n </div>\n <div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/packages/localize/src/localize/src/localize.ts?message=docs(localize)%3A%20describe%20your%20change...#L144-L156\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n <a href=\"https://github.com/angular/angular/tree/12.0.0-next.7/packages/localize/src/localize/src/localize.ts#L144-L156\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n </div>\n \n <header class=\"api-header\">\n <h1 id=\"localize\">$localize<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/localize/init/$localize#localize\"><i class=\"material-icons\">link</i></a></h1>\n <label class=\"api-type-label global\">global</label>\n <label class=\"api-type-label const\">const</label>\n \n \n \n </header>\n \n <aio-toc class=\"embedded\"></aio-toc>\n\n <div class=\"api-body\">\n \n <section class=\"short-description\">\n <p>Tag a template literal string for localization.</p>\n\n <p><a href=\"api/localize/init/$localize#description\">See more...</a></p>\n </section>\n \n \n \n <code-example language=\"ts\" hidecopy=\"true\" class=\"no-box api-heading\">\n const $localize: LocalizeFn;\n </code-example>\n\n \n\n \n \n<section class=\"description\">\n <h2 id=\"description\">Description<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/localize/init/$localize#description\"><i class=\"material-icons\">link</i></a></h2>\n <p>For example:</p>\n<code-example language=\"ts\">\n$localize `some string to localize`\n</code-example>\n<p><strong>Providing meaning, description and id</strong></p>\n<p>You can optionally specify one or more of <code>meaning</code>, <code>description</code> and <code>id</code> for a localized\nstring by pre-pending it with a colon delimited block of the form:</p>\n<code-example language=\"ts\">\n$localize`:meaning|description@@id:source message text`;\n\n$localize`:meaning|:source message text`;\n$localize`:description:source message text`;\n$localize`:@@id:source message text`;\n</code-example>\n<p>This format is the same as that used for <code>i18n</code> markers in Angular templates. See the\n<a href=\"guide/i18n#mark-text-for-translations\">Angular 18n guide</a>.</p>\n<p><strong>Naming placeholders</strong></p>\n<p>If the template literal string contains expressions, then the expressions will be automatically\nassociated with placeholder names for you.</p>\n<p>For example:</p>\n<code-example language=\"ts\">\n$localize `Hi ${name}! There are ${items.length} items.`;\n</code-example>\n<p>will generate a message-source of <code>Hi {$PH}! There are {$PH_1} items</code>.</p>\n<p>The recommended practice is to name the placeholder associated with each expression though.</p>\n<p>Do this by providing the placehold
|
||
|
}
|