Review article:
1: Autumn Park QBlog technical principles Analysis: Opening: overall understanding of (a) - the role of the overall presentation folders and files
2: Autumn Park QBlog technical principles of analysis: understanding the whole point of the process flow (B) - Introduction Autumn Park business processes
3: Autumn Park QBlog resolve technical principles: UrlRewrite principle of no URL suffix (C) - describes how to implement no URL suffix
4: Autumn Park QBlog resolve technical principles: UrlRewrite of URL redirection system (four) - describes how to navigate to the URL handler
5: Autumn Park QBlog resolve technical principles: Module design of the page base class (E) - describes how to create a custom base class and life cycle
6: Autumn Park QBlog resolve technical principles: Module of the page base class - lifecycle process (f) - describes the life cycle of internal business base class
7: Autumn Park QBlog resolve technical principles: Module of the base class life cycle - the page loads (seven) - Introduction to html interface to load principle
8: Autumn Park QBlog resolve technical principles: Web page of the process - content filling (eight) - describes how the content is fill html
ps: Autumn Park QBlog Download: http://www.cyqdata.com/download/article-detail-427
Recalling the previous section:
The festival QBlog Autumn Garden resolve technical principles: Web page of the process - filling contents (VIII) , the analysis of the content of the page html how to be filled, and Set, SetFor, SetForeach small three two how to simplify development.
Look to see everyone's very excited, I write to write very sad
This section describes:
Less gossip, let me see the following:
A: multi-language translation of the principle of analytic
First Review Section VII : Page_PreLoad part of the process of code:
When Section VII, resolved to everyone how to load properly handle html and CSS / image path, this section will complement the principles of multi-language translation of the resolution.
1: traditional multi-language translation
I once wrote an article: actual articles - much simpler language implementation , introduced CYQ.Data MutilLanguage under .Xml, in the traditional aspx page, you can achieve multi-language translation as follows:
As long as the text to be translated, replaced by the same label syntax, you can obtain the corresponding multilingual effect, which seems to have a lot of people very convenient, but also is widely used with.
However, still have a conservative say a few words:
1.1: Browse effect destroyed the original interface, modified interface, not secondary use:
Traditional webform development, continue with server-side controls, server syntax, CMS own tag syntax invasion in this site belong to html and legendary art world, the interface after the invasion, no longer belongs to the art-recognized html.
He came out of the MVC, with no ViewState been talked about, but did not change the server html syntax invasion of habit.
There is reasonable, it brings rapid development effect for ASP the .NET brings rapid expansion .... quite quickly.
For this, I have to say is more conservative, I do not think the invasion is not good, because in fact, there are many projects to be quickly developed to violent.
Unless you can bring a more rapid development approach than the invasion of html, otherwise, it can not deny its existence and change.
1.2: a page full of a lot of these labels, in addition to the original developer, who took over maintenance, you have to be silly, especially E-wen bad person, like I said:
After fooled everyone above two points, took the point to say Autumn Park QBlog how to deal with:
2: Autumn Park QBlog multi-language translation mechanism
Autumn Park QBlog is based on the html xml loaded as a way to handle interface, easy operation html as xml like.
In XmlHelper when the help is required to obtain a node or nodes in a batch, it is quite simple.
Ever since, we had the idea and practice of the following methods:
See Example html tags:
<li><a href="/" key="index">首页</a></li>
<input keyvalue="submit" type="submit" name="btnPost" value="提交" class="Button Button_Style" />
Description:
From the above three tabs, to see that very clearly knew what the label is displayed,
It does not affect the original preview of html tags, just like xml-like increase of two custom properties: key, keyvalue.
Two small labels, but we can complete the translation needs of the entire Autumn Park station multi-language, how to do? Let us look at the following introduction:
1: Convention translated keywords
Text key = "id", id looking node from the same directory language.html text, the translation of key internal node: key
Text attribute value of key = "id", id looking node from the same directory language.html text translation keyvalue node: keyvalue
The above two translation master key, i.e. the label may be placed at any interface html, as exemplified above as html
Incidentally, a few nagging:
However, the developers want to effort and worry, have in the base class, so write down a short code:
2: Translation of the implementation code
{
System.Xml.XmlNodeList list = doc.GetList("*", "key");//获取所有带key标签的节点
System.Xml.XmlAttribute attr = null;
if (list != null && list.Count > 0)
{
string key = null;
for (int i = 0; i < list.Count; i++)
{
attr = list[i].Attributes["key"];
key = attr.Value;
list[i].InnerXml = _Language.Get(key);//翻译
list[i].Attributes.Remove(attr);//移除key属性
}
}
list = doc.GetList("*", "keyvalue");//获取所有带keyvalue标签的节点
if (list != null && list.Count > 0)
{
string key = null;
for (int i = 0; i < list.Count; i++)
{
attr = list[i].Attributes["keyvalue"];
key = attr.Value;
list[i].Attributes["value"].InnerXml = _Language.Get(key);//翻译
list[i].Attributes.Remove(attr);//移除keyvalue属性
}
}
}
I believe such a simple code for each spectators are read to understand, not much chatter, and everyone looked to the force on the line.
And then on the two Autumn Park QBlog of charge to the point of view of the spectacle Logo:
When Chinese:
E When text:
to sum up:
In this section, the analysis of the Autumn Garden QBlog multi-language translation mechanism: the use of labels by acquiring all of the nodes of the agreement, a replacement cycle, which once solved the whole station translation problems.
At the same time, creating a new method, the developer placed in the body for many years mechanical-type translation work, a one-time liberation gave art community personnel, and to achieve a relatively progressive isolation of certain duties.
The next section, everyone will complete example demonstrates VIII, while adding translated content in this section include multiple languages, so stay tuned.
Reproduced in: https: //my.oschina.net/secyaher/blog/274287