From a1536aecc6beda913a9fb65a2fd32961214c0da1 Mon Sep 17 00:00:00 2001 From: Valdis Iljuconoks Date: Mon, 25 Mar 2024 00:49:55 +0200 Subject: [PATCH] fixed docs for working with enums --- docs/translate-enum-net.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/translate-enum-net.md b/docs/translate-enum-net.md index 6ffbf056..1405a88c 100644 --- a/docs/translate-enum-net.md +++ b/docs/translate-enum-net.md @@ -24,8 +24,9 @@ public class Document Now you can use following snippet to give end-user localized dropdown list of available document statuses: -``` +```razor @using DbLocalizationProvider +@inject ILocalizationProvider Provider @model Document @{ @@ -34,7 +35,7 @@ Now you can use following snippet to give end-user localized dropdown list of av .Select(s => new SelectListItem { Value = s.ToString(), - Text = s.Translate() + Text = Provider.Translate(s) }); } @@ -43,11 +44,12 @@ Now you can use following snippet to give end-user localized dropdown list of av Or if you just need to output current status of the document to the end-user: -``` +```razor @using DbLocalizationProvider +@inject ILocalizationProvider Provider @model Document -@Model.Status.Translate() +@Provider.Translate(Model.Status) ``` ## Specify Translation for Enum