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
24e4dac2
Commit
24e4dac2
authored
Sep 26, 2017
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
2d7e326d
80b36921
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
191 additions
and
272 deletions
+191
-272
Makefile
Makefile
+14
-14
locale/nolocales.js
locale/nolocales.js
+0
-20
locale/single_locale.js
locale/single_locale.js
+0
-23
src/config.js
src/config.js
+4
-25
src/converse-core.js
src/converse-core.js
+159
-10
src/converse-muc.js
src/converse-muc.js
+13
-2
src/locales.js
src/locales.js
+0
-52
src/utils.js
src/utils.js
+1
-126
No files found.
Makefile
View file @
24e4dac2
...
...
@@ -172,33 +172,33 @@ BUILDS = dist/converse.js \
dist/converse-no-dependencies.min.js
\
dist/converse-no-dependencies.js
dist/converse.js
:
transpile src
locale
node_modules *.js
dist/converse.js
:
transpile src node_modules *.js
$(RJS)
-o
src/build.js
include
=
converse
out
=
dist/converse.js
optimize
=
none
dist/converse.min.js
:
src
locale
node_modules *.js
dist/converse.min.js
:
src node_modules *.js
$(RJS)
-o
src/build.js
include
=
converse
out
=
dist/converse.min.js
dist/converse-esnext.js
:
src
locale
node_modules *.js transpile
dist/converse-esnext.js
:
src node_modules *.js transpile
$(RJS)
-o
src/build-esnext.js
include
=
converse
out
=
dist/converse-esnext.js
optimize
=
none
dist/converse-esnext.min.js
:
src
locale
node_modules *.js transpile
dist/converse-esnext.min.js
:
src node_modules *.js transpile
$(RJS)
-o
src/build-esnext.js
include
=
converse
out
=
dist/converse-esnext.min.js
dist/inverse.js
:
transpile src
locale
node_modules *.js
dist/inverse.js
:
transpile src node_modules *.js
$(RJS)
-o
src/build-inverse.js
include
=
inverse
out
=
dist/inverse.js
optimize
=
none
dist/inverse.min.js
:
src
locale
node_modules *.js
dist/inverse.min.js
:
src node_modules *.js
$(RJS)
-o
src/build-inverse.js
include
=
inverse
out
=
dist/inverse.min.js
dist/converse-no-jquery.js
:
transpile src
locale
node_modules *.js
dist/converse-no-jquery.js
:
transpile src node_modules *.js
$(RJS)
-o
src/build.js
include
=
converse wrap.endFile
=
end-no-jquery.frag
exclude
=
jquery
exclude
=
jquery.noconflict
out
=
dist/converse-no-jquery.js
optimize
=
none
dist/converse-no-jquery.min.js
:
src
locale
node_modules *.js transpile
dist/converse-no-jquery.min.js
:
src node_modules *.js transpile
$(RJS)
-o
src/build.js
include
=
converse wrap.endFile
=
end-no-jquery.frag
exclude
=
jquery
exclude
=
jquery.noconflict
out
=
dist/converse-no-jquery.min.js
dist/converse-no-dependencies.js
:
transpile src
locale
node_modules *.js
dist/converse-no-dependencies.js
:
transpile src node_modules *.js
$(RJS)
-o
src/build-no-dependencies.js
optimize
=
none
out
=
dist/converse-no-dependencies.js
dist/converse-no-dependencies.min.js
:
src
locale
node_modules *.js
dist/converse-no-dependencies.min.js
:
src node_modules *.js
$(RJS)
-o
src/build-no-dependencies.js
out
=
dist/converse-no-dependencies.min.js
dist/converse-mobile.js
:
transpile src
locale
node_modules *.js
dist/converse-mobile.js
:
transpile src node_modules *.js
$(RJS)
-o
src/build.js paths.converse
=
src/converse-mobile
include
=
converse
out
=
dist/converse-mobile.js
optimize
=
none
dist/converse-mobile.min.js
:
src
locale
node_modules *.js
dist/converse-mobile.min.js
:
src node_modules *.js
$(RJS)
-o
src/build.js paths.converse
=
src/converse-mobile
include
=
converse
out
=
dist/converse-mobile.min.js
dist/converse-muc-embedded.js
:
transpile src
locale
node_modules *.js
dist/converse-muc-embedded.js
:
transpile src node_modules *.js
$(RJS)
-o
src/build.js paths.converse
=
src/converse-embedded
include
=
converse
out
=
dist/converse-muc-embedded.js
optimize
=
none
dist/converse-muc-embedded.min.js
:
src
locale
node_modules *.js
dist/converse-muc-embedded.min.js
:
src node_modules *.js
$(RJS)
-o
src/build.js paths.converse
=
src/converse-embedded
include
=
converse
out
=
dist/converse-muc-embedded.min.js
.PHONY
:
jsmin
...
...
locale/nolocales.js
deleted
100644 → 0
View file @
2d7e326d
/*
* This file can be used if no locale support is required.
*/
(
function
(
root
,
factory
)
{
define
(
"
locales
"
,
[
'
jed
'
],
function
(
Jed
)
{
var
translations
=
{
"
domain
"
:
"
converse
"
,
"
locale_data
"
:
{
"
converse
"
:
{
""
:
{
"
domain
"
:
"
converse
"
,
"
lang
"
:
"
en
"
,
"
plural_forms
"
:
"
nplurals=2; plural=(n != 1);
"
}
}
}
};
root
.
locales
=
{
'
en
'
:
new
Jed
(
translations
)
};
});
})(
this
);
locale/single_locale.js
deleted
100644 → 0
View file @
2d7e326d
/*
* This file specifies a single language dependency (for English).
*
* Translations take up a lot of space and you are therefore advised to remove
* from here any languages that you don't need.
*/
(
function
(
root
,
factory
)
{
require
.
config
({
paths
:
{
"
jed
"
:
"
Libraries/jed
"
,
"
en
"
:
"
locale/en/LC_MESSAGES/en
"
}
});
define
(
"
locales
"
,
[
'
jed
'
,
'
en
'
],
function
(
jed
,
en
)
{
root
.
locales
=
{};
root
.
locales
.
en
=
en
;
});
})(
this
);
src/config.js
View file @
24e4dac2
...
...
@@ -26,6 +26,7 @@ require.config({
"
es6-promise
"
:
"
node_modules/es6-promise/dist/es6-promise.auto
"
,
"
eventemitter
"
:
"
node_modules/otr/build/dep/eventemitter
"
,
"
form-utils
"
:
"
src/form-utils
"
,
"
jed
"
:
"
node_modules/jed/jed
"
,
"
jquery
"
:
"
node_modules/jquery/dist/jquery
"
,
"
jquery.browser
"
:
"
node_modules/jquery.browser/dist/jquery.browser
"
,
"
jquery.noconflict
"
:
"
src/jquery.noconflict
"
,
...
...
@@ -33,10 +34,9 @@ require.config({
"
lodash.converter
"
:
"
3rdparty/lodash.fp
"
,
"
lodash.fp
"
:
"
src/lodash.fp
"
,
"
lodash.noconflict
"
:
"
src/lodash.noconflict
"
,
"
moment_with_locales
"
:
"
3rdparty/moment_locales
"
,
"
pluggable
"
:
"
node_modules/pluggable.js/dist/pluggable
"
,
"
polyfill
"
:
"
src/polyfill
"
,
"
virtual-dom
"
:
"
node_modules/virtual-dom/dist/virtual-dom
"
,
"
vdom-parser
"
:
"
node_modules/vdom-parser/dist
"
,
"
sizzle
"
:
"
node_modules/jquery/sizzle/dist/sizzle
"
,
"
strophe
"
:
"
node_modules/strophe.js/strophe
"
,
"
strophe.disco
"
:
"
node_modules/strophejs-plugin-disco/strophe.disco
"
,
...
...
@@ -47,6 +47,8 @@ require.config({
"
tpl
"
:
"
node_modules/lodash-template-loader/loader
"
,
"
underscore
"
:
"
src/underscore-shim
"
,
"
utils
"
:
"
src/utils
"
,
"
vdom-parser
"
:
"
node_modules/vdom-parser/dist
"
,
"
virtual-dom
"
:
"
node_modules/virtual-dom/dist/virtual-dom
"
,
"
xss
"
:
"
node_modules/xss/dist/xss
"
,
"
xss.noconflict
"
:
"
src/xss.noconflict
"
,
...
...
@@ -82,29 +84,6 @@ require.config({
"
crypto
"
:
"
node_modules/otr/build/dep/crypto
"
,
"
salsa20
"
:
"
node_modules/otr/build/dep/salsa20
"
,
"
otr
"
:
"
node_modules/otr/build/otr
"
,
// Locales paths
"
locales
"
:
"
src/locales
"
,
"
jed
"
:
"
node_modules/jed/jed
"
,
"
af
"
:
"
locale/af/LC_MESSAGES/converse.json
"
,
"
ca
"
:
"
locale/ca/LC_MESSAGES/converse.json
"
,
"
de
"
:
"
locale/de/LC_MESSAGES/converse.json
"
,
"
es
"
:
"
locale/es/LC_MESSAGES/converse.json
"
,
"
fr
"
:
"
locale/fr/LC_MESSAGES/converse.json
"
,
"
he
"
:
"
locale/he/LC_MESSAGES/converse.json
"
,
"
hu
"
:
"
locale/hu/LC_MESSAGES/converse.json
"
,
"
id
"
:
"
locale/id/LC_MESSAGES/converse.json
"
,
"
it
"
:
"
locale/it/LC_MESSAGES/converse.json
"
,
"
ja
"
:
"
locale/ja/LC_MESSAGES/converse.json
"
,
"
nb
"
:
"
locale/nb/LC_MESSAGES/converse.json
"
,
"
nl
"
:
"
locale/nl/LC_MESSAGES/converse.json
"
,
"
pl
"
:
"
locale/pl/LC_MESSAGES/converse.json
"
,
"
pt_BR
"
:
"
locale/pt_BR/LC_MESSAGES/converse.json
"
,
"
ru
"
:
"
locale/ru/LC_MESSAGES/converse.json
"
,
"
uk
"
:
"
locale/uk/LC_MESSAGES/converse.json
"
,
"
zh
"
:
"
locale/zh/LC_MESSAGES/converse.json
"
,
"
moment_with_locales
"
:
"
3rdparty/moment_locales
"
,
},
packages
:
[{
...
...
src/converse-core.js
View file @
24e4dac2
This diff is collapsed.
Click to expand it.
src/converse-muc.js
View file @
24e4dac2
...
...
@@ -246,8 +246,19 @@
* loaded by converse.js's plugin machinery.
*/
const
{
_converse
}
=
this
,
{
__
}
=
_converse
,
{
___
}
=
utils
;
{
__
}
=
_converse
;
function
___
(
str
)
{
/* 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 further below.
*/
return
str
;
}
// XXX: Inside plugins, all calls to the translation machinery
// (e.g. utils.__) should only be done in the initialize function.
// If called before, we won't know what language the user wants,
...
...
src/locales.js
deleted
100755 → 0
View file @
2d7e326d
/*
* This file specifies the language dependencies.
*
* Translations take up a lot of space and you are therefore advised to remove
* from here any languages that you don't need.
*
* See also src/moment_locales.js
*/
/*global define */
(
function
(
root
,
factory
)
{
define
([
'
jed
'
,
'
text!af
'
,
'
text!ca
'
,
'
text!de
'
,
'
text!es
'
,
'
text!fr
'
,
'
text!he
'
,
'
text!hu
'
,
'
text!id
'
,
'
text!it
'
,
'
text!ja
'
,
'
text!nb
'
,
'
text!nl
'
,
'
text!pl
'
,
'
text!pt_BR
'
,
'
text!ru
'
,
'
text!uk
'
,
'
text!zh
'
],
function
(
$
,
Jed
)
{
root
.
locales
=
{
'
en
'
:
{},
'
af
'
:
arguments
[
1
],
'
ca
'
:
arguments
[
2
],
'
de
'
:
arguments
[
3
],
'
es
'
:
arguments
[
4
],
'
fr
'
:
arguments
[
5
],
'
he
'
:
arguments
[
6
],
'
hu
'
:
arguments
[
7
],
'
id
'
:
arguments
[
8
],
'
it
'
:
arguments
[
9
],
'
ja
'
:
arguments
[
10
],
'
nb
'
:
arguments
[
11
],
'
nl
'
:
arguments
[
12
],
'
pl
'
:
arguments
[
13
],
'
pt-br
'
:
arguments
[
14
],
'
ru
'
:
arguments
[
15
],
'
uk
'
:
arguments
[
16
],
'
zh
'
:
arguments
[
17
]
};
return
root
.
locales
;
});
})(
this
);
src/utils.js
View file @
24e4dac2
...
...
@@ -6,14 +6,13 @@
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define, escape,
locales, window, Jed
*/
/*global define, escape,
window
*/
(
function
(
root
,
factory
)
{
define
([
"
sizzle
"
,
"
es6-promise
"
,
"
jquery.browser
"
,
"
lodash.noconflict
"
,
"
locales
"
,
"
moment_with_locales
"
,
"
strophe
"
,
],
factory
);
...
...
@@ -22,12 +21,10 @@
Promise
,
jQBrowser
,
_
,
locales
,
moment
,
Strophe
)
{
"
use strict
"
;
locales
=
locales
||
{};
const
b64_sha1
=
Strophe
.
SHA1
.
b64_sha1
;
Strophe
=
Strophe
.
Strophe
;
...
...
@@ -109,78 +106,6 @@
var
u
=
{};
// Translation machinery
// ---------------------
u
.
fetchLocale
=
(
locale
,
locales_url
)
=>
new
Promise
((
resolve
,
reject
)
=>
{
if
(
!
u
.
isLocaleSupported
(
locale
)
||
locale
===
'
en
'
)
{
resolve
();
}
const
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'
GET
'
,
_
.
template
(
locales_url
)({
'
locale
'
:
locale
}),
true
);
xhr
.
setRequestHeader
(
'
Accept
'
,
"
application/json, text/javascript
"
);
xhr
.
onload
=
function
()
{
if
(
xhr
.
status
>=
200
&&
xhr
.
status
<
400
)
{
resolve
(
new
Jed
(
window
.
JSON
.
parse
(
xhr
.
responseText
)));
}
else
{
xhr
.
onerror
();
}
};
xhr
.
onerror
=
function
()
{
reject
(
xhr
.
statusText
);
};
xhr
.
send
();
});
u
.
__
=
function
(
_converse
,
str
)
{
if
(
_
.
isUndefined
(
window
.
Jed
))
{
return
str
;
}
if
(
_
.
isUndefined
(
_converse
.
jed
))
{
return
Jed
.
sprintf
.
apply
(
window
.
Jed
,
[].
slice
.
call
(
arguments
,
1
));
}
var
t
=
_converse
.
jed
.
translate
(
str
);
if
(
arguments
.
length
>
1
)
{
return
t
.
fetch
.
apply
(
t
,
[].
slice
.
call
(
arguments
,
2
));
}
else
{
return
t
.
fetch
();
}
};
u
.
___
=
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 in src/converse-muc.js
*/
return
str
;
};
u
.
isLocaleAvailable
=
function
(
locale
,
available
)
{
/* Check whether the locale or sub locale (e.g. en-US, en) is supported.
*
* Parameters:
* (Function) available - returns a boolean indicating whether the locale is supported
*/
if
(
available
(
locale
))
{
return
locale
;
}
else
{
var
sublocale
=
locale
.
split
(
"
-
"
)[
0
];
if
(
sublocale
!==
locale
&&
available
(
sublocale
))
{
return
sublocale
;
}
}
};
u
.
addHyperlinks
=
function
(
text
)
{
const
list
=
text
.
match
(
URL_REGEX
)
||
[];
var
links
=
[];
...
...
@@ -480,56 +405,6 @@
};
};
u
.
detectLocale
=
function
(
library_check
)
{
/* Determine which locale is supported by the user's system as well
* as by the relevant library (e.g. converse.js or moment.js).
*
* Parameters:
* (Function) library_check - returns a boolean indicating whether
* the locale is supported.
*/
var
locale
,
i
;
if
(
window
.
navigator
.
userLanguage
)
{
locale
=
u
.
isLocaleAvailable
(
window
.
navigator
.
userLanguage
,
library_check
);
}
if
(
window
.
navigator
.
languages
&&
!
locale
)
{
for
(
i
=
0
;
i
<
window
.
navigator
.
languages
.
length
&&
!
locale
;
i
++
)
{
locale
=
u
.
isLocaleAvailable
(
window
.
navigator
.
languages
[
i
],
library_check
);
}
}
if
(
window
.
navigator
.
browserLanguage
&&
!
locale
)
{
locale
=
u
.
isLocaleAvailable
(
window
.
navigator
.
browserLanguage
,
library_check
);
}
if
(
window
.
navigator
.
language
&&
!
locale
)
{
locale
=
u
.
isLocaleAvailable
(
window
.
navigator
.
language
,
library_check
);
}
if
(
window
.
navigator
.
systemLanguage
&&
!
locale
)
{
locale
=
u
.
isLocaleAvailable
(
window
.
navigator
.
systemLanguage
,
library_check
);
}
return
locale
||
'
en
'
;
};
u
.
isLocaleSupported
=
function
(
locale
)
{
/* Check whether the passed in locale is supported by Converse */
if
(
!
_
.
isString
(
locale
))
{
return
false
;
}
return
_
.
includes
(
_
.
keys
(
locales
||
{}),
locale
);
};
u
.
isMomentLocale
=
function
(
locale
)
{
if
(
!
_
.
isString
(
locale
))
{
return
false
;
}
return
moment
.
locale
()
!==
moment
.
locale
(
locale
);
};
u
.
getLocale
=
function
(
preferred_locale
,
isSupportedByLibrary
)
{
if
(
_
.
isString
(
preferred_locale
))
{
if
(
preferred_locale
===
'
en
'
||
isSupportedByLibrary
(
preferred_locale
))
{
return
preferred_locale
;
}
}
return
u
.
detectLocale
(
isSupportedByLibrary
)
||
'
en
'
;
};
u
.
isOfType
=
function
(
type
,
item
)
{
return
item
.
get
(
'
type
'
)
==
type
;
};
...
...
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