Commit 2d747bb2 authored by JC Brand's avatar JC Brand

Various changes. See below.

* Update localisation/translation documentation due to recent changes.
* Remove `moment_locales.js` and instead load the moment locales in `src/i18n.js`
* Mention how to load the fullscreen version. Refs #939
parent 2f0a91ff
/*
* This file specifies the supported locales for moment.js.
*
* 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/locales.js
*/
(function (root, factory) {
define("moment_with_locales", [
'moment', // Everything below can be removed except for moment itself.
'moment/locale/af',
'moment/locale/ca',
'moment/locale/de',
'moment/locale/es',
'moment/locale/fr',
'moment/locale/he',
'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/ru',
'moment/locale/uk',
// 'moment/locale/zh' (No longer in locales, now only with
// country codes, e.g. zh-cn.js zh-hk.js zh-tw.js).
], function (moment) {
return moment;
});
})(this);
...@@ -5,6 +5,11 @@ ...@@ -5,6 +5,11 @@
### Bugfixes ### Bugfixes
- Don't require `auto_login` to be `true` when using the API to log in. - Don't require `auto_login` to be `true` when using the API to log in.
- Moment locale wasn't being set to the value passed via the `i18n` option. - Moment locale wasn't being set to the value passed via the `i18n` option.
- Refetch the roster from the server after reconnection.
From the perspective of the XMPP server, this is an entirely new login,
and therefore as per [RFC-6121](https://tools.ietf.org/html/rfc6121#section-2.1.6)
the roster SHOULD be queried, making the client an "interested resource".
Otherwise connected contacts might not get your presence updates.
### New Features ### New Features
- #828 Add routing for the `#converse-login` and `#converse-register` URL - #828 Add routing for the `#converse-login` and `#converse-register` URL
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -645,6 +645,8 @@ confusing and appears "broken". ...@@ -645,6 +645,8 @@ confusing and appears "broken".
If you are however aware of this issue and still want to allow the `offline` If you are however aware of this issue and still want to allow the `offline`
state, then you can set this option to `true` to enable it. state, then you can set this option to `true` to enable it.
.. _`i18n`:
i18n i18n
---- ----
...@@ -699,6 +701,34 @@ See also: ...@@ -699,6 +701,34 @@ See also:
`XEP-0198 <http://xmpp.org/extensions/xep-0198.html>`_, specifically `XEP-0198 <http://xmpp.org/extensions/xep-0198.html>`_, specifically
with regards to "stream resumption". with regards to "stream resumption".
.. _`locales`:
locales
-------
* Default:
.. code-block:: javascript
locales: [
'af', 'ca', 'de',
'es', 'en', 'fr',
'he', 'hu', 'id',
'it', 'ja', 'nb',
'nl', 'pl', 'pt_BR',
'ru', 'uk', 'zh'
]
This setting restricts the locales that are supported by Converse.js and
therefore what may be given as value for the :ref:`i18n` option.
Any other locales will be ignored.
When self-hosting, also make sure that the locales are served and therefore
fetchable (via ``XMLHttpRequest``) at the URL specified by :ref:`locales-url`.
.. _`locales-url`:
locales_url locales_url
----------- -----------
...@@ -707,7 +737,7 @@ locales_url ...@@ -707,7 +737,7 @@ locales_url
The URL from where Converse.js should fetch translation JSON. The URL from where Converse.js should fetch translation JSON.
The three curly braces ``{{{ }}}`` are The three curly braces ``{{{ }}}`` are
`Mustache<https://github.com/janl/mustache.js#readme>`_-style `Mustache <https://github.com/janl/mustache.js#readme>`_-style
variable interpolation which HTML-escapes the value being inserted. It's variable interpolation which HTML-escapes the value being inserted. It's
important that the inserted value is HTML-escaped, otherwise a malicious script important that the inserted value is HTML-escaped, otherwise a malicious script
injection attack could be attempted. injection attack could be attempted.
......
...@@ -33,6 +33,11 @@ via the *script* and *link* tags: ...@@ -33,6 +33,11 @@ via the *script* and *link* tags:
<link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/css/converse.min.css"> <link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/css/converse.min.css">
<script src="https://cdn.conversejs.org/dist/converse.min.js"></script> <script src="https://cdn.conversejs.org/dist/converse.min.js"></script>
.. note:: For the fullscreen version of converse.js, replace
``converse.min.js`` with ``inverse.min.js`` and ``converse.min.css`` with
``inverse.min.css``.
.. note:: Instead of always loading the latest version of Converse.js via the .. note:: Instead of always loading the latest version of Converse.js via the
CDN, it's generally better to load a specific version (preferably the CDN, it's generally better to load a specific version (preferably the
latest one), to avoid breakage when new backwards-incompatible versions are latest one), to avoid breakage when new backwards-incompatible versions are
...@@ -61,12 +66,22 @@ Alternative builds of Converse.js ...@@ -61,12 +66,22 @@ Alternative builds of Converse.js
================================= =================================
The minified ``.js`` and ``.css`` files provide the same functionality as is available The minified ``.js`` and ``.css`` files provide the same functionality as is available
on the `conversejs.org <http://conversejs.org>`_ website. Useful for testing or demoing. on the `conversejs.org <https://conversejs.org>`_ website. Useful for testing or demoing.
Alternative builds are however also available via the CDN. Alternative builds are however also available via the CDN.
Mobile build Fullscreen version
------------ ------------------
Converse.js also comes in a fullscreen version (often referred to as Inverse).
A hosted version is available online at `inverse.chat <https://inverse.chat>`_.
To load the fullscreen version, simply replace
``converse.min.js`` with ``inverse.min.js`` and ``converse.min.css`` with
``inverse.min.css``.
Mobile version
--------------
Besides the default build mentioned above, there is a build intended for mobile Besides the default build mentioned above, there is a build intended for mobile
websites, called ``converse-mobile.min.js``. websites, called ``converse-mobile.min.js``.
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
<div id="banner"><a href="https://github.com/jcbrand/converse.js/blob/master/docs/source/setup.rst">Edit me on GitHub</a></div> <div id="banner"><a href="https://github.com/jcbrand/converse.js/blob/master/docs/source/setup.rst">Edit me on GitHub</a></div>
.. _what-you-will-need:
===================== =====================
Setup and integration Setup and integration
===================== =====================
.. _what-you-will-need:
This page documents what you'll need to do to be able to connect Converse.js with This page documents what you'll need to do to be able to connect Converse.js with
your own XMPP server and to better integrate it into your website. your own XMPP server and to better integrate it into your website.
......
...@@ -6,15 +6,38 @@ ...@@ -6,15 +6,38 @@
Translations Translations
============ ============
.. note:: Converse.js supports localization of its user interface and date formats. As
Translations take up a lot of space and will bloat your minified file. of writing, 17 languages are supported.
At the time of writing, all the translations add about 50KB of extra data to
the minified javascript file. Therefore, make sure to only The translations of converse.js can be found in the `locale
include those languages which you intend to support and remove from <https://github.com/jcbrand/converse.js/tree/master/locale>`_ directory.
./src/locales.js those which you don't need. Remember to rebuild the
minified file afterwards, by running `make build`. Translations of Converse.js are very welcome. You can add translations either
manually by editing the ``.po`` files in the above-mentioned ``locale``
directory, or through the web at `weblate <https://hosted.weblate.org/projects/conversejs/#languages>`_.
As of version 3.3.0, converse.js no longer automatically bundles translations
in its source file and instead fetches only the relevant locale for the current
session from a URL as specified by the :ref:`locales-url` setting.
There are three configuration settings relevant to translations and
localisation. You're encouraged to read the documentation for each of them.
* :ref:`i18n`
* :ref:`locales`
* :ref:`locales-url`
Manually updating translations
==============================
If you simply want to add a few missing translations, then consider doing it
through the web at `weblate <https://hosted.weblate.org/projects/conversejs/#languages>`_.
Some things however cannot be done via weblate and instead have to be done
manually in a checkout of the converse.js source repository.
These tasks are documented below.
----------------------------------------------
Updating the translations template (.pot file) Updating the translations template (.pot file)
---------------------------------------------- ----------------------------------------------
...@@ -38,8 +61,6 @@ After adding the string, you'll need to regenerate the POT file: ...@@ -38,8 +61,6 @@ After adding the string, you'll need to regenerate the POT file:
make pot make pot
-------------------------------------------
Making translations file for a new language Making translations file for a new language
------------------------------------------- -------------------------------------------
...@@ -64,7 +85,6 @@ the JavaScript translations library that we're using. ...@@ -64,7 +85,6 @@ the JavaScript translations library that we're using.
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"plural_forms: nplurals=2; plural=(n != 1);\n" "plural_forms: nplurals=2; plural=(n != 1);\n"
--------------------------------------
Updating an existing translations file Updating an existing translations file
-------------------------------------- --------------------------------------
...@@ -84,8 +104,6 @@ To do this for ALL languages, run: ...@@ -84,8 +104,6 @@ To do this for ALL languages, run:
The resulting `.po` file is then what gets translated. The resulting `.po` file is then what gets translated.
-----------------------------------------------------
Generating a JavaScript file from a translations file Generating a JavaScript file from a translations file
----------------------------------------------------- -----------------------------------------------------
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
"jquery.noconflict", "jquery.noconflict",
"backbone.browserStorage", "backbone.browserStorage",
"backbone.overview", "backbone.overview",
"moment_with_locales", "moment",
"strophe", "strophe",
"strophe.disco", "strophe.disco",
"strophe.rsm", "strophe.rsm",
......
...@@ -35,7 +35,6 @@ require.config({ ...@@ -35,7 +35,6 @@ require.config({
"lodash.converter": "3rdparty/lodash.fp", "lodash.converter": "3rdparty/lodash.fp",
"lodash.fp": "src/lodash.fp", "lodash.fp": "src/lodash.fp",
"lodash.noconflict": "src/lodash.noconflict", "lodash.noconflict": "src/lodash.noconflict",
"moment_with_locales": "3rdparty/moment_locales",
"pluggable": "node_modules/pluggable.js/dist/pluggable", "pluggable": "node_modules/pluggable.js/dist/pluggable",
"polyfill": "src/polyfill", "polyfill": "src/polyfill",
"sizzle": "node_modules/jquery/sizzle/dist/sizzle", "sizzle": "node_modules/jquery/sizzle/dist/sizzle",
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"polyfill", "polyfill",
"i18n", "i18n",
"utils", "utils",
"moment_with_locales", "moment",
"strophe", "strophe",
"pluggable", "pluggable",
"backbone.noconflict", "backbone.noconflict",
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
define('lodash', [], function () { return _; }); define('lodash', [], function () { return _; });
define('lodash.converter', [], function () { return fp; }); define('lodash.converter', [], function () { return fp; });
define('lodash.noconflict', [], function () { return _; }); define('lodash.noconflict', [], function () { return _; });
define('moment_with_locales', [], function () { return moment; });
define('strophe', [], function () { define('strophe', [], function () {
return { return {
'Strophe': Strophe, 'Strophe': Strophe,
......
...@@ -13,7 +13,23 @@ ...@@ -13,7 +13,23 @@
"es6-promise", "es6-promise",
"jed", "jed",
"lodash.noconflict", "lodash.noconflict",
"moment_with_locales" "moment",
'moment/locale/af',
'moment/locale/ca',
'moment/locale/de',
'moment/locale/es',
'moment/locale/fr',
'moment/locale/he',
'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/ru',
'moment/locale/uk',
], factory); ], factory);
}(this, function (Promise, Jed, _, moment) { }(this, function (Promise, Jed, _, moment) {
'use strict'; 'use strict';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment