多語言載入圖片問題

來源:互聯網
上載者:User

系統要求多語言:中文和英文,分別在兩個xml檔案中書寫相關內容,類似:

<root>
   <resource name="VersionName">Version</resource>   <resource name="Logout">Logout</resource>
</root>

關於多語言的處理在一個類中定義好了,前台頁面方法如下:

<td  width="7%" align="right">   
   <%=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("sct-log")%>在

<td id="<%=ResourceManager.GetString("sct-log")%>" width="225" height="50" align="left" ></td>

中是沒有提示的。而且引號中還有引號,竟然可以使用。看來前台跟幕後處理真的不一樣。後台這樣寫絕對錯誤。自己的前台html,js還真的很菜。記錄一下,以備以後查閱。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.