[ 1 post ]

bible

  • Username: DazzlingBeing
  • Joined: Sun Jun 24, 2012 8:35 pm
  • Posts: 6
  • Offline
  • Profile

how to use Y.Intl in a intl module

Post Posted: Thu Aug 02, 2012 1:09 am
+0-
I create a custom module,and a language file,then using YUI builder build these files,they have this structure:
build
-----myModle
---------assets
---------lang
--------------myModle_en.js
---------myModle.js

myModle.js:
Y.add("mymodle", function(Y) {
......
},"1.0.0" ,{lang:['en'], requires:['intl']}););

myModle_en.js:
YUI.add("lang/mymodle_en",function(a){a.Intl.add("mymodle","en",{OK:"Ok",CANCEL:"Cancel"});},"1.0.0");

the page:
YUI({
filter: "raw",
modules : {
"mymodle" : {
type : "js",
fullpath : build/myModle/myModle.js?time="+ (new Date()).getTime() +""
},
lang : "en"
}).use("mymodle", function (Y) {...});

in myModle.js, I use Y.Intl.get("mymodle").OK,it return undefined.

why it can not get the resource bundle?
If I add lang/mymodle_en to mymodle's requeres:
requires:['intl', 'lang/mymodle_en ']
and In YUI config, the modules add myModle_en.js:
modules : {
"mymodle" : {
type : "js",
fullpath : build/myModle/myModle.js
},
"lang/mymodle_en" : {
type : "js",
fullpath : build/myModle/lang/mymodle_en.js
},
}
then it can get the resource

I saw the console module, it's not these complicated. Is anything I forget to set?
  [ 1 post ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum