make i18n more AMD compliant

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1359581 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-07-10 10:39:42 +00:00
parent 94489731e3
commit d3731db036
3 changed files with 17 additions and 3 deletions

View File

@ -151,7 +151,7 @@
require(['jquery','i18n','sammy','startup','domReady!'], function (domReady) {
require(['jquery','i18n','sammy','startup','utils','domReady!'], function (domReady) {
loadi18n(function () {
$.ajax({
url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(),

View File

@ -20,6 +20,7 @@
define("utils",["jquery","i18n","jquery.tmpl"], function() {
loadi18n=function(loadCallback){
$.log("loadi18n");
var browserLang = usedLang();
$.log("use browserLang:"+browserLang);

View File

@ -12,6 +12,18 @@
*
*****************************************************************************/
(function($, window) {
(function(factory){
// Support module loading scenarios
if (typeof define === 'function' && define.amd){
// AMD Anonymous Module
define(['jquery'], factory);
} else {
// No module loader (plain <script> tag) - put directly in global namespace
$.sammy = window.Sammy = factory($);
}
})
(function($) {
$.i18n = {};
@ -478,5 +490,6 @@ String.prototype.split = function (separator, limit) {
return cbSplit(this, separator, limit);
};
})(jQuery);
});
})(jQuery, window);