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
50064ec1
Commit
50064ec1
authored
Sep 27, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Translation bugfix. Wait until after `locales` attribute is there
parent
80b36921
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
37 deletions
+56
-37
.gitignore
.gitignore
+1
-0
Makefile
Makefile
+10
-11
package-lock.json
package-lock.json
+23
-1
src/converse-core.js
src/converse-core.js
+22
-25
No files found.
.gitignore
View file @
50064ec1
...
...
@@ -39,6 +39,7 @@ Backbone.Overview
tags
stamp-npm
stamp-bundler
transpile
# Sphinx
docs/html
...
...
Makefile
View file @
50064ec1
...
...
@@ -153,9 +153,8 @@ watch: stamp-bundler
watchjs
:
stamp-npm
$(BABEL)
--source-maps
--watch
=
./src
--out-dir
=
./builds
.PHONY
:
transpile
transpile
:
stamp-npm
$(BABEL)
--source-maps
--out-dir
=
./builds ./src
transpile
:
stamp-npm src
$(BABEL)
--source-maps
--out-dir
=
./builds ./src
&&
touch
transpile
BUILDS
=
dist/converse.js
\
dist/converse.min.js
\
...
...
@@ -174,31 +173,31 @@ BUILDS = dist/converse.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 node_modules *.js
dist/converse.min.js
:
transpile
src node_modules *.js
$(RJS)
-o
src/build.js
include
=
converse
out
=
dist/converse.min.js
dist/converse-esnext.js
:
src node_modules *.js
transpile
dist/converse-esnext.js
:
src node_modules *.js
$(RJS)
-o
src/build-esnext.js
include
=
converse
out
=
dist/converse-esnext.js
optimize
=
none
dist/converse-esnext.min.js
:
src node_modules *.js
transpile
dist/converse-esnext.min.js
:
src node_modules *.js
$(RJS)
-o
src/build-esnext.js
include
=
converse
out
=
dist/converse-esnext.min.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 node_modules *.js
dist/inverse.min.js
:
transpile
src node_modules *.js
$(RJS)
-o
src/build-inverse.js
include
=
inverse
out
=
dist/inverse.min.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 node_modules *.js transpile
dist/converse-no-jquery.min.js
:
transpile
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 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 node_modules *.js
dist/converse-no-dependencies.min.js
:
transpile
src node_modules *.js
$(RJS)
-o
src/build-no-dependencies.js
out
=
dist/converse-no-dependencies.min.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 node_modules *.js
dist/converse-mobile.min.js
:
transpile
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 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 node_modules *.js
dist/converse-muc-embedded.min.js
:
transpile
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
...
...
package-lock.json
View file @
50064ec1
...
...
@@ -7782,7 +7782,10 @@
"version"
:
"0.2.16"
,
"resolved"
:
"https://registry.npmjs.org/otr/-/otr-0.2.16.tgz"
,
"integrity"
:
"sha1-BKdTRPUi38sHeMVDjA9V5p0+i8E="
,
"dev"
:
true
"dev"
:
true
,
"requires"
:
{
"webworker-threads"
:
"0.4.13"
}
},
"output-file-sync"
:
{
"version"
:
"1.1.2"
,
...
...
@@ -9661,6 +9664,25 @@
"integrity"
:
"sha1-03Uy1bfv9oJwIMtE2OyqIzyWeMU="
,
"dev"
:
true
},
"webworker-threads"
:
{
"version"
:
"0.4.13"
,
"resolved"
:
"https://registry.npmjs.org/webworker-threads/-/webworker-threads-0.4.13.tgz"
,
"integrity"
:
"sha1-1zvf0AIb9wkxy4XCTMP0zvvrH5g="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"nan"
:
"0.8.0"
},
"dependencies"
:
{
"nan"
:
{
"version"
:
"0.8.0"
,
"resolved"
:
"https://registry.npmjs.org/nan/-/nan-0.8.0.tgz"
,
"integrity"
:
"sha1-AiqPpen+hCCWSsH7PclOF/RJ9f0="
,
"dev"
:
true
,
"optional"
:
true
}
}
},
"which"
:
{
"version"
:
"1.3.0"
,
"resolved"
:
"https://registry.npmjs.org/which/-/which-1.3.0.tgz"
,
...
...
src/converse-core.js
View file @
50064ec1
...
...
@@ -197,9 +197,9 @@
}
else
{
return
t
.
fetch
();
}
}
;
}
const
detectLocale
=
function
(
library_check
)
{
function
detectLocale
(
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).
*
...
...
@@ -226,23 +226,23 @@
locale
=
isLocaleAvailable
(
window
.
navigator
.
systemLanguage
,
library_check
);
}
return
locale
||
'
en
'
;
}
;
}
const
isMomentLocale
=
function
(
locale
)
{
function
isMomentLocale
(
locale
)
{
if
(
!
_
.
isString
(
locale
))
{
return
false
;
}
return
moment
.
locale
()
!==
moment
.
locale
(
locale
);
}
;
}
const
getLocale
=
function
(
preferred_locale
,
isSupportedByLibrary
)
{
function
getLocale
(
preferred_locale
,
isSupportedByLibrary
)
{
if
(
_
.
isString
(
preferred_locale
))
{
if
(
preferred_locale
===
'
en
'
||
isSupportedByLibrary
(
preferred_locale
))
{
return
preferred_locale
;
}
}
return
_converse
.
detectLocale
(
isSupportedByLibrary
)
||
'
en
'
;
}
;
return
detectLocale
(
isSupportedByLibrary
)
||
'
en
'
;
}
const
isLocaleAvailable
=
function
(
locale
,
available
)
{
function
isLocaleAvailable
(
locale
,
available
)
{
/* Check whether the locale or sub locale (e.g. en-US, en) is supported.
*
* Parameters:
...
...
@@ -257,9 +257,9 @@
return
sublocale
;
}
}
}
;
}
const
isLocaleSupported
=
function
(
locale
)
{
function
isLocaleSupported
(
locale
)
{
/* Check whether the passed in locale is supported by Converse
*
* Parameters:
...
...
@@ -267,25 +267,21 @@
*/
if
(
!
_
.
isString
(
locale
))
{
return
false
;
}
return
_
.
includes
(
_converse
.
locales
,
locale
);
}
;
}
const
fetchLocale
=
(
locale
,
locale_url
)
=>
function
fetchTranslations
(
locale
,
locale_url
)
{
/* Fetch the translations for the given local at the given URL.
*
* Parameters:
* (String) locale: The given i18n locale
* (String) locale_url: The URL from which the translations should be fetched
*/
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
!
isLocaleSupported
(
locale
)
||
locale
===
'
en
'
)
{
return
resolve
();
}
const
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'
GET
'
,
locale_url
,
true
);
xhr
.
open
(
'
GET
'
,
locale_url
,
true
);
xhr
.
setRequestHeader
(
'
Accept
'
,
"
application/json, text/javascript
"
...
...
@@ -302,6 +298,7 @@
};
xhr
.
send
();
});
}
// --------------------------
// END: Translation machinery
// --------------------------
...
...
@@ -377,11 +374,6 @@
'
INACTIVE
'
:
90000
};
/* Internationalization */
moment
.
locale
(
getLocale
(
settings
.
i18n
,
isMomentLocale
));
_converse
.
locale
=
getLocale
(
settings
.
i18n
,
isLocaleSupported
);
const
__
=
_converse
.
__
;
// XEP-0085 Chat states
// http://xmpp.org/extensions/xep-0085.html
this
.
INACTIVE
=
'
inactive
'
;
...
...
@@ -453,6 +445,11 @@
}
}
/* Internationalization */
moment
.
locale
(
getLocale
(
settings
.
i18n
,
isMomentLocale
));
_converse
.
locale
=
getLocale
(
settings
.
i18n
,
isLocaleSupported
);
const
__
=
_converse
.
__
;
// Module-level variables
// ----------------------
this
.
callback
=
callback
||
_
.
noop
;
...
...
@@ -2033,7 +2030,7 @@
finishInitialization
();
return
_converse
;
}
else
{
fetch
Locale
(
fetch
Translations
(
_converse
.
locale
,
_
.
template
(
_converse
.
locales_url
)({
'
locale
'
:
_converse
.
locale
})
).
then
((
jed
)
=>
{
...
...
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