Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
55c57a34
Commit
55c57a34
authored
Oct 13, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move translation factory to utils
So that it can be used by plugins.
parent
970da2ac
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
44 deletions
+69
-44
converse.js
converse.js
+24
-32
src/deps-full.js
src/deps-full.js
+4
-3
src/deps-no-otr.js
src/deps-no-otr.js
+4
-3
src/deps-website-no-otr.js
src/deps-website-no-otr.js
+4
-3
src/deps-website.js
src/deps-website.js
+4
-3
src/utils.js
src/utils.js
+29
-0
No files found.
converse.js
View file @
55c57a34
...
...
@@ -12,19 +12,34 @@
define
(
"
converse
"
,
[
"
converse-dependencies
"
,
"
converse-templates
"
],
function
(
dependencies
,
templates
)
{
var
otr
=
dependencies
.
otr
,
moment
=
dependencies
.
moment
;
var
otr
=
dependencies
.
otr
;
if
(
typeof
otr
!==
"
undefined
"
)
{
return
factory
(
dependencies
.
jQuery
,
_
,
otr
.
OTR
,
otr
.
DSA
,
templates
,
moment
);
return
factory
(
dependencies
.
jQuery
,
_
,
otr
.
OTR
,
otr
.
DSA
,
templates
,
dependencies
.
moment
,
dependencies
.
utils
);
}
else
{
return
factory
(
dependencies
.
jQuery
,
_
,
undefined
,
undefined
,
templates
,
moment
);
return
factory
(
dependencies
.
jQuery
,
_
,
undefined
,
undefined
,
templates
,
dependencies
.
moment
,
dependencies
.
utils
);
}
}
);
}
else
{
root
.
converse
=
factory
(
jQuery
,
_
,
OTR
,
DSA
,
JST
,
moment
);
root
.
converse
=
factory
(
jQuery
,
_
,
OTR
,
DSA
,
JST
,
moment
,
utils
);
}
}(
this
,
function
(
$
,
_
,
OTR
,
DSA
,
templates
,
moment
)
{
}(
this
,
function
(
$
,
_
,
OTR
,
DSA
,
templates
,
moment
,
utils
)
{
// "use strict";
// Cannot use this due to Safari bug.
// See https://github.com/jcbrand/converse.js/issues/196
...
...
@@ -297,30 +312,8 @@
// Translation machinery
// ---------------------
var
__
=
$
.
proxy
(
function
(
str
)
{
// Translation factory
if
(
this
.
i18n
===
undefined
)
{
this
.
i18n
=
locales
.
en
;
}
var
t
=
this
.
i18n
.
translate
(
str
);
if
(
arguments
.
length
>
1
)
{
return
t
.
fetch
.
apply
(
t
,
[].
slice
.
call
(
arguments
,
1
));
}
else
{
return
t
.
fetch
();
}
},
this
);
var
___
=
function
(
str
)
{
/* XXX: This is part of a hack to get gettext to scan strings to be
* translated. Strings we cannot send to the function above because
* they require variable interpolation and we don't yet have the
* variables at scan time.
*
* See actionInfoMessages
*/
return
str
;
};
var
__
=
utils
.
__
;
var
___
=
utils
.
___
;
// Translation aware constants
// ---------------------------
var
OTR_CLASS_MAPPING
=
{};
...
...
@@ -1100,7 +1093,6 @@
// are mentioned.
extra_classes
+=
'
mentioned
'
;
}
var
message
=
template
({
'
sender
'
:
msg_dict
.
sender
,
'
time
'
:
msg_time
.
format
(
'
hh:mm
'
),
...
...
@@ -4626,7 +4618,7 @@
this
.
_initializePlugins
=
function
()
{
_
.
each
(
this
.
plugins
,
$
.
proxy
(
function
(
plugin
)
{
$
.
proxy
(
plugin
,
this
)();
$
.
proxy
(
plugin
,
this
)(
this
);
},
this
));
};
...
...
src/deps-full.js
View file @
55c57a34
define
(
"
converse-dependencies
"
,
[
"
jquery
"
,
"
utils
"
,
"
otr
"
,
"
moment
"
,
"
locales
"
,
...
...
@@ -7,16 +8,16 @@ define("converse-dependencies", [
"
backbone.overview
"
,
"
jquery.browser
"
,
"
typeahead
"
,
"
utils
"
,
"
strophe
"
,
"
strophe.muc
"
,
"
strophe.roster
"
,
"
strophe.vcard
"
,
"
strophe.disco
"
],
function
(
$
,
otr
,
moment
)
{
],
function
(
$
,
utils
,
otr
,
moment
)
{
return
{
'
jQuery
'
:
$
,
'
moment
'
:
moment
,
'
otr
'
:
otr
,
'
moment
'
:
moment
'
utils
'
:
utils
};
});
src/deps-no-otr.js
View file @
55c57a34
define
(
"
converse-dependencies
"
,
[
"
jquery
"
,
"
utils
"
,
"
moment
"
,
"
locales
"
,
"
backbone.browserStorage
"
,
"
backbone.overview
"
,
"
jquery.browser
"
,
"
typeahead
"
,
"
utils
"
,
"
strophe
"
,
"
strophe.muc
"
,
"
strophe.roster
"
,
"
strophe.vcard
"
,
"
strophe.disco
"
],
function
(
$
,
moment
)
{
],
function
(
$
,
utils
,
moment
)
{
return
{
'
jQuery
'
:
$
,
'
otr
'
:
undefined
,
'
moment
'
:
moment
'
moment
'
:
moment
,
'
utils
'
:
utils
};
});
src/deps-website-no-otr.js
View file @
55c57a34
define
(
"
converse-dependencies
"
,
[
"
jquery
"
,
"
utils
"
,
"
moment
"
,
"
locales
"
,
"
bootstrapJS
"
,
// XXX: Can be removed, only for https://conversejs.org
...
...
@@ -8,16 +9,16 @@ define("converse-dependencies", [
"
jquery.browser
"
,
"
jquery.easing
"
,
// XXX: Can be removed, only for https://conversejs.org
"
typeahead
"
,
"
utils
"
,
"
strophe
"
,
"
strophe.muc
"
,
"
strophe.roster
"
,
"
strophe.vcard
"
,
"
strophe.disco
"
],
function
(
$
,
moment
)
{
],
function
(
$
,
utils
,
moment
)
{
return
{
'
jQuery
'
:
$
,
'
otr
'
:
undefined
,
'
moment
'
:
moment
'
moment
'
:
moment
,
'
utils
'
:
utils
};
});
src/deps-website.js
View file @
55c57a34
define
(
"
converse-dependencies
"
,
[
"
jquery
"
,
"
utils
"
,
"
otr
"
,
"
moment
"
,
"
locales
"
,
...
...
@@ -9,16 +10,16 @@ define("converse-dependencies", [
"
jquery.browser
"
,
"
jquery.easing
"
,
// XXX: Only for https://conversejs.org
"
typeahead
"
,
"
utils
"
,
"
strophe
"
,
"
strophe.muc
"
,
"
strophe.roster
"
,
"
strophe.vcard
"
,
"
strophe.disco
"
],
function
(
$
,
otr
,
moment
)
{
],
function
(
$
,
utils
,
otr
,
moment
)
{
return
{
'
jQuery
'
:
$
,
'
otr
'
:
otr
,
'
moment
'
:
moment
'
moment
'
:
moment
,
'
utils
'
:
utils
};
});
src/utils.js
View file @
55c57a34
...
...
@@ -26,4 +26,33 @@ define(["jquery"], function ($) {
}
return
this
;
};
var
utils
=
{
// Translation machinery
// ---------------------
__
:
$
.
proxy
(
function
(
str
)
{
// Translation factory
if
(
this
.
i18n
===
undefined
)
{
this
.
i18n
=
locales
.
en
;
}
var
t
=
this
.
i18n
.
translate
(
str
);
if
(
arguments
.
length
>
1
)
{
return
t
.
fetch
.
apply
(
t
,
[].
slice
.
call
(
arguments
,
1
));
}
else
{
return
t
.
fetch
();
}
},
this
),
___
:
function
(
str
)
{
/* XXX: This is part of a hack to get gettext to scan strings to be
* translated. Strings we cannot send to the function above because
* they require variable interpolation and we don't yet have the
* variables at scan time.
*
* See actionInfoMessages
*/
return
str
;
}
};
return
utils
;
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment