系统要求多语言:中文和英文,分别在两个xml文件中书写相关内容,类似:
<root>
<resource name="VersionName">Version</resource>
<resource name="VersionName">Version</resource>
<resource name="Logout">Logout</resource>
</root>
</root>
关于多语言的处理在一个类中定义好了,前台页面方法如下:
<td width="7%" align="right">
<%=ResourceManager.GetString("VersionName")%><%--帐号版本--%>
</td>
<%=ResourceManager.GetString("VersionName")%><%--帐号版本--%>
</td>
这个是文字替换。同时,图片也要做替换,没有实现多语言图片前,图片是通过css文件控制的。
<td id="sct-log" width="225" height="50" align="left" ></td>
在css文件中设置sct-log的背景图片。要求多语言后,还是在css中设置背景图片,但这里有两个。例如sct-log-zh和sct-log-en中分别设置对应中文和英文的图片。前台还是想设置成<%=ResourceManager.GetString("sct-log")%>,然后,分别在两个xml配置文件中加入以下配置:<resource name="sct-log">sct-log-zh</resource>和<resource name="sct-log">sct-log-en</resource>。ResourceManager.GetString("VersionName")方法在
<td width="7%" align="right">
<%=ResourceManager.GetString("VersionName")%><%--帐号版本--%>
</td>
<%=ResourceManager.GetString("VersionName")%><%--帐号版本--%>
</td>
中有提示,但<%=ResourceManager.GetString("sct-log")%>在
<td id="<%=ResourceManager.GetString("sct-log")%>" width="225" height="50" align="left" ></td>
中是没有提示的。而且引号中还有引号,竟然可以使用。看来前台跟后台处理真的不一样。后台这样写绝对错误。自己的前台html,js还真的很菜。记录一下,以备以后查阅。