当前位置: 代码迷 >> Web前端 >> 如何用properties
  详细解决方案

如何用properties

热度:134   发布时间:2012-10-06 17:34:01.0
怎么用properties

转自:http://zhongzhihua.iteye.com/blog/77772

?

?

一,先在xul文件中写上

xml 代码

  1. < stringbundle ? id = "bundle_prefs" ? src = "chrome://messenger/locale/prefs.properties" /> ??

?

<stringbundle id="bundle_prefs" src="chrome://messenger/locale/prefs.properties"></stringbundle>
<stringbundle id="bundle_prefs" src="chrome://messenger/locale/prefs.properties"></stringbundle>
<stringbundle id="bundle_prefs" src="chrome://messenger/locale/prefs.properties"></stringbundle>

再prefs.properties中写上这想写的中文字,如failedDuplicateAccount = 复制此帐户失败。

再js中的写一个全局变量如:var gPrefsBundle ,再 onload()中加载它?gPrefsBundle = document.getElementById("bundle_prefs");现在这个gPrefsBundle 变量就是prefs.properties文件了,你想得到"复制此帐户失败。" 这句话只要

var alertText = gPrefsBundle.getString("failedDuplicateAccount");
??????? window.alert(alertText);

这样就可以打印出"复制此帐户失败";

  相关解决方案