From 553825cf4330d31df7f3b542c3120f43a589db7a Mon Sep 17 00:00:00 2001 From: Anchor Date: Sat, 28 Feb 2015 21:42:46 -0800 Subject: [PATCH] Finish translation fix for 14.5.md --- en/14.5.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/en/14.5.md b/en/14.5.md index e888b600..01d56a39 100644 --- a/en/14.5.md +++ b/en/14.5.md @@ -60,17 +60,17 @@ In order to facilitate multi-language calls in the template package directly, we return beego.Translation.Money(s) } -## Use multi-language development +## Multi-language development -1. Set the location of language and language packs, then initialize the i18n objects: +1. Setting the language and location of the language pack, then initialize i18n objects: beego.Lang = "zh" beego.LangPath = "views/lang" beego.InitLang() -2. Design Multi-language Pack +2. Designing a multi-language package - The above talked about how to initialize multi language pack, the language pack is now designing multi, multi-language package is json file, as described in Chapter X, we need to design a document on LangPath following example zh.json or en.json + Above, we talked about how to initialize a multi-language package. Now, let's look at how to design one. Multi-language packages are typically JSON files, as you've already seen in Chapter 10. We must provide translation files for languages we wish to support on our `LangPath`, such as the following: # zh.json @@ -90,16 +90,16 @@ In order to facilitate multi-language calls in the template package directly, we } } -3. Use the Language Pack +3. Using language packages - We can call the controller to get the response of the translation language translation, as follows: + We can call the controller to get the translated response in the desired language, like so:: func (this *MainController) Get() { this.Data["create"] = beego.Translation.Translate("create") this.TplNames = "index.tpl" } - We can also directly call response in the template translation function: + We can also directly interpolate translated responses in our templates: // Direct Text translation {{.create | Trans}}