From 31ccb5d05cf96ad3c952a816182b28222e17bc98 Mon Sep 17 00:00:00 2001
From: maliming <6908465+maliming@users.noreply.github.com>
Date: Mon, 18 May 2020 14:40:53 +0800
Subject: [PATCH] Update Text-Templating.md.
---
docs/en/Text-Templating.md | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/docs/en/Text-Templating.md b/docs/en/Text-Templating.md
index 18a360c5c8..c71787f598 100644
--- a/docs/en/Text-Templating.md
+++ b/docs/en/Text-Templating.md
@@ -204,13 +204,14 @@ Inline localization uses the [localization system](Localization.md) to localize
Assuming you need to send an email to a user to reset her/his password. Here, the template content:
````
-{%{{{L "ResetMyPassword"}}}%}
+{%{{{L "ResetMyPassword" model.name}}}%}
````
`L` function is used to localize the given key based on the current user culture. You need to define the `ResetMyPassword` key inside your localization file:
````json
-"ResetMyPassword": "Click here to reset your password"
+"ResetMyPasswordTitle": "Reset my password",
+"ResetMyPassword": "Hi {0}, Click here to reset your password"
````
You also need to declare the localization resource to be used with this template, inside your template definition provider class:
@@ -234,6 +235,7 @@ var result = await _templateRenderer.RenderAsync(
"PasswordReset", //the template name
new PasswordResetModel
{
+ Name = "john",
Link = "https://abp.io/example-link?userId=123&token=ABC"
}
);
@@ -242,7 +244,7 @@ var result = await _templateRenderer.RenderAsync(
You will see the localized result:
````csharp
-Click here to reset your password
+Hi john, Click here to reset your password
````
> If you define the [default localization resource](Localization.md) for your application, then no need to declare the resource type for the template definition.