File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
src/docs/reference/modules/Localize Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -136,9 +136,9 @@ It is necessary to reference the `OrchardCore.Localization.Abstractions` package
136
136
137
137
```
138
138
msgctxt "TheAdmin.Views.Layout"
139
- msgid "1 book"
139
+ msgid "{0} book"
140
140
msgid_plural "{0} books"
141
- msgstr[0] "[1 livre]"
141
+ msgstr[0] "[{0} livre]"
142
142
msgstr[1] "[{0} livres]"
143
143
```
144
144
@@ -148,8 +148,15 @@ msgstr[1] "[{0} livres]"
148
148
- Inject an instance of ` IStringLocalizer ` or ` IViewLocalizer ` (represented as the ` T ` variable in the following example).
149
149
150
150
``` csharp
151
- T .Plural (count , " 1 book" , " {0} books" )
151
+ T .Plural (count , " {0} book" , " {0} books" )
152
152
```
153
+ In this example
154
+ * ` "{0} book" ` is the singular form
155
+ * ` "{0} books" ` is the plural form
156
+ * ` count ` will determine if the singular or plural form is used and will replace the {0} placeholder
157
+
158
+ !!! warning
159
+ You should not hardcode a number in the singular or plural forms because different languages have different rules about when each form is used.
153
160
154
161
### Extract translations to PO files
155
162
You can’t perform that action at this time.
0 commit comments