i18n internationalization The usual practice is to use the gettext, that is, the use of special keywords in the source code to identify the string will probably be translated, such as
@if (model.iscustomerforummoderator) { class='status'> <label>@t (" Forum.status"):</label> <span>@t ("forum.moderator" ) </span> </li> }
@T ("xxxx") This code means to translate the word "forum.status".
So how do we extract these strings after we have developed a project? In fact, at least 20 years ago, this tool was already in effect, and (https://www.gnu.org/software/gettext/) Xgettext.exe was doing it.
GetText has quite a long documentation, contains a lot of tools, and extracts strings with Xgettext
1. First we have to tell xgettext what the input source is.
We use the following code to generate a list of files to be extracted
dir *.cshtml/s/b>cshtml.list
Output files are similar
2. Using Xgettext to generate PO files
Xgettext--files-from= "C:\Users\ user name \documents\opensource\nop\presentation\nop.web\cshtml.list"--output-dir=c:\ Noptext--language=c#-kt-knopresourcedisplayname--from-code=utf-8
* Need to create a directory Noptext (you can specify it yourself),-kt, indicate t as the keyword
The resulting PO file is:
With the PO file you can use translation tools to translate!!
Client tools are recommended here https://poedit.net/
Or the famous Crowdin on the line (fee): https://crowdin.com/
-----------------------------------------------------AD Divider--------------------------------------------------------------- ----------------------------
Finally, welcome to the NOP translation project.
Https://crowdin.com/project/nopcommerce
Extracting multi-language placeholders in C # using GetText (Nopcommerce sample article)