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
99a017fc
Commit
99a017fc
authored
May 20, 2015
by
JC Brand
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'thierrytiti-detect_lang'
parents
b08b2253
1d0ffe34
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletion
+30
-1
converse.js
converse.js
+26
-1
docs/CHANGES.rst
docs/CHANGES.rst
+1
-0
docs/source/configuration.rst
docs/source/configuration.rst
+3
-0
No files found.
converse.js
View file @
99a017fc
...
...
@@ -215,7 +215,32 @@
// Translation machinery
// ---------------------
this
.
i18n
=
settings
.
i18n
?
settings
.
i18n
:
locales
.
en
;
this
.
isAvailableLocale
=
function
(
locale
){
ret
=
null
;
if
(
locales
[
locale
])
ret
=
locales
[
locale
];
else
{
sublocale
=
locale
.
split
(
"
-
"
)[
0
];
if
(
sublocale
!=
locale
&&
locales
[
sublocale
])
ret
=
locales
[
sublocale
];
}
return
ret
;
};
this
.
detectLocale
=
function
(){
ret
=
null
;
if
(
window
.
navigator
.
userLanguage
)
ret
=
this
.
isAvailableLocale
(
window
.
navigator
.
userLanguage
);
else
if
(
window
.
navigator
.
languages
&&
!
ret
){
for
(
var
i
=
0
;
i
<
window
.
navigator
.
languages
.
length
&&
!
ret
;
i
++
)
{
ret
=
this
.
isAvailableLocale
(
window
.
navigator
.
languages
[
i
]);
}
}
else
if
(
window
.
navigator
.
browserLanguage
&&
!
ret
)
ret
=
this
.
isAvailableLocale
(
window
.
navigator
.
browserLanguage
);
else
if
(
window
.
navigator
.
language
&&
!
ret
)
ret
=
this
.
isAvailableLocale
(
window
.
navigator
.
language
);
else
if
(
window
.
navigator
.
systemLanguage
&&
!
ret
)
ret
=
this
.
isAvailableLocale
(
window
.
navigator
.
systemLanguage
);
else
{
ret
=
locales
.
en
}
return
ret
;
};
this
.
i18n
=
settings
.
i18n
?
settings
.
i18n
:
this
.
detectLocale
();
var
__
=
$
.
proxy
(
utils
.
__
,
this
);
var
___
=
utils
.
___
;
...
...
docs/CHANGES.rst
View file @
99a017fc
...
...
@@ -13,6 +13,7 @@ Changelog
* Updated French translation [thierrytiti]
* CSS fix: position and width of the div #conversejs [thierrytiti]
* CSS fix: room-info bug on hover after room description loaded [thierrytiti]
* I18N: Autodetection of User Locale if no i18n setting is set. [thierrytiti]
0.9.3 (2015-05-01)
------------------
...
...
docs/source/configuration.rst
View file @
99a017fc
...
...
@@ -360,6 +360,9 @@ If set to ``true``, then don't show offline users.
i18n
----
* Default: Auto-detection of the User/Browser language
If no locale is matching available locales, the default is ``en``.
Specify the locale/language. The language must be in the ``locales`` object. Refer to
``./locale/locales.js`` to see which locales are supported.
...
...
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