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
35a1693a
Commit
35a1693a
authored
Nov 15, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use es2015 module imports in i18n.js
parent
a5fdbb0e
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
341 additions
and
266 deletions
+341
-266
dist/converse.js
dist/converse.js
+201
-121
src/headless/i18n.js
src/headless/i18n.js
+140
-145
No files found.
dist/converse.js
View file @
35a1693a
This diff is collapsed.
Click to expand it.
src/headless/i18n.js
View file @
35a1693a
...
...
@@ -8,42 +8,38 @@
//
/*global define */
(
function
(
root
,
factory
)
{
define
([
"
es6-promise/dist/es6-promise.auto
"
,
"
jed
"
,
"
./lodash.noconflict
"
,
"
moment
"
,
'
moment/locale/af
'
,
'
moment/locale/ar
'
,
'
moment/locale/bg
'
,
'
moment/locale/ca
'
,
'
moment/locale/cs
'
,
'
moment/locale/de
'
,
'
moment/locale/es
'
,
'
moment/locale/eu
'
,
'
moment/locale/fr
'
,
'
moment/locale/he
'
,
'
moment/locale/hi
'
,
'
moment/locale/hu
'
,
'
moment/locale/id
'
,
'
moment/locale/it
'
,
'
moment/locale/ja
'
,
'
moment/locale/nb
'
,
'
moment/locale/nl
'
,
'
moment/locale/pl
'
,
'
moment/locale/pt-br
'
,
'
moment/locale/ro
'
,
'
moment/locale/ru
'
,
'
moment/locale/tr
'
,
'
moment/locale/uk
'
,
'
moment/locale/zh-cn
'
,
'
moment/locale/zh-tw
'
],
factory
);
}(
this
,
function
(
Promise
,
Jed
,
_
,
moment
)
{
'
use strict
'
;
import
'
moment/locale/af
'
;
import
'
moment/locale/ar
'
;
import
'
moment/locale/bg
'
;
import
'
moment/locale/ca
'
;
import
'
moment/locale/cs
'
;
import
'
moment/locale/de
'
;
import
'
moment/locale/es
'
;
import
'
moment/locale/eu
'
;
import
'
moment/locale/fr
'
;
import
'
moment/locale/he
'
;
import
'
moment/locale/hi
'
;
import
'
moment/locale/hu
'
;
import
'
moment/locale/id
'
;
import
'
moment/locale/it
'
;
import
'
moment/locale/ja
'
;
import
'
moment/locale/nb
'
;
import
'
moment/locale/nl
'
;
import
'
moment/locale/pl
'
;
import
'
moment/locale/pt-br
'
;
import
'
moment/locale/ro
'
;
import
'
moment/locale/ru
'
;
import
'
moment/locale/tr
'
;
import
'
moment/locale/uk
'
;
import
'
moment/locale/zh-cn
'
;
import
'
moment/locale/zh-tw
'
;
import
Jed
from
"
jed
"
;
import
Promise
from
"
es6-promise/dist/es6-promise.auto
"
;
import
_
from
"
./lodash.noconflict
"
;
import
moment
from
"
moment
"
;
function
detectLocale
(
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).
*
...
...
@@ -70,26 +66,26 @@
locale
=
isLocaleAvailable
(
window
.
navigator
.
systemLanguage
,
library_check
);
}
return
locale
||
'
en
'
;
}
}
function
isMomentLocale
(
locale
)
{
function
isMomentLocale
(
locale
)
{
return
_
.
includes
(
moment
.
locales
(),
locale
);
}
}
function
isConverseLocale
(
locale
,
supported_locales
)
{
function
isConverseLocale
(
locale
,
supported_locales
)
{
return
_
.
isString
(
locale
)
&&
_
.
includes
(
supported_locales
,
locale
);
}
}
function
getLocale
(
preferred_locale
,
isSupportedByLibrary
)
{
function
getLocale
(
preferred_locale
,
isSupportedByLibrary
)
{
if
(
_
.
isString
(
preferred_locale
))
{
if
(
preferred_locale
===
'
en
'
||
isSupportedByLibrary
(
preferred_locale
))
{
return
preferred_locale
;
}
}
return
detectLocale
(
isSupportedByLibrary
)
||
'
en
'
;
}
}
function
isLocaleAvailable
(
locale
,
available
)
{
function
isLocaleAvailable
(
locale
,
available
)
{
/* Check whether the locale or sub locale (e.g. en-US, en) is supported.
*
* Parameters:
...
...
@@ -104,11 +100,11 @@
return
sublocale
;
}
}
}
}
let
jed_instance
;
let
jed_instance
;
return
{
export
default
{
setLocales
(
preferred_locale
,
_converse
)
{
_converse
.
locale
=
getLocale
(
...
...
@@ -169,5 +165,4 @@
xhr
.
send
();
});
}
};
}));
};
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