2012-02-07 61 views
0

例如,我們只是帶有下一個元素的網頁:Web應用程序的本地化文件。如何實施正確的結構?

page title(<title>My Page </title>);

page title(<h2>Hello! It is My Page!</h2>);

表:

表名(This is a table!);

錶行名(<th>id</th>, <th>Name</th>, <th>Description</th>);

部分鏈接(<a>Back</a>, <a>Exit</a>);

正如你所看到的 - 非常簡單。

我的下一個問題:

什麼局部變量的名字最好的做法是什麼?

例1:

title1 =My Page; 

title2 = Hello! It is My Page; 

table_name=This is a table; 

id=Id; 

name=Name; 

description=Description; 

back=Back; 

exit=Exit; 

例2:

page.title=My Page; 

h2.title =Hello! It is My Page; 

table.name = This is a table; 

table.row.id.name = Id; 

table.row.name.name = Name; 

table.row.description.name = Description; 

link.back = Back; 

link.exit = Exit; 

例3:

indexPage.page.title =My page; 

indexPage.h2.title = Hello! This is My Page; 

indexPage.table.name = This is a table; 

indexPage.table.row.id.name = Id; 

indexPage.table.row.name.name = Name; 

indexPage.table.row.description.name = Description; 

indexPage.link.back = Back; 

indexPage.link.exit = Exit; 

如果我的應用程序只包含一個網頁 - 我認爲,例如1 - 完美變體,但.. 如果我有很多頁面,頁面上有很多不同的元素簡單1 - 真的失敗,你同意我嗎?

因此,我正試圖爲命名語言環境變量創建最成功,靈活,快速和簡單的算法。

我認爲,例3 - 最好的變體,但變量名 - 很長。我不確定 - 它是非常靈活和簡單的... ...

所以,我重複我的問題,您用於本地化變量名稱的做法是什麼?

回答

0

Web應用程序通常使用開發框架提供的基礎結構進行本地化。您沒有提到如何構建應用程序,但是如果您搜索框架的文檔(例如ASP.NET,RoR,PHP)以進行「本地化」,您應該能夠找到所需的所有信息。

相關問題