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
This commit is contained in:
parent
b686fa1672
commit
2bce9e7272
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* 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 @@
|
|||
### Bugfixes
|
||||
- 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.
|
||||
- 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
|
||||
- #828 Add routing for the `#converse-login` and `#converse-register` URL
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -645,6 +645,8 @@ confusing and appears "broken".
|
|||
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.
|
||||
|
||||
.. _`i18n`:
|
||||
|
||||
i18n
|
||||
----
|
||||
|
||||
|
@ -699,6 +701,34 @@ See also:
|
|||
`XEP-0198 <http://xmpp.org/extensions/xep-0198.html>`_, specifically
|
||||
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
|
||||
-----------
|
||||
|
||||
|
@ -707,7 +737,7 @@ locales_url
|
|||
The URL from where Converse.js should fetch translation JSON.
|
||||
|
||||
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
|
||||
important that the inserted value is HTML-escaped, otherwise a malicious script
|
||||
injection attack could be attempted.
|
||||
|
|
|
@ -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">
|
||||
<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
|
||||
CDN, it's generally better to load a specific version (preferably the
|
||||
latest one), to avoid breakage when new backwards-incompatible versions are
|
||||
|
@ -61,12 +66,22 @@ Alternative builds of Converse.js
|
|||
=================================
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
websites, called ``converse-mobile.min.js``.
|
||||
|
|
|
@ -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>
|
||||
|
||||
.. _what-you-will-need:
|
||||
|
||||
=====================
|
||||
Setup and integration
|
||||
=====================
|
||||
|
||||
.. _what-you-will-need:
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -6,15 +6,38 @@
|
|||
Translations
|
||||
============
|
||||
|
||||
.. note::
|
||||
Translations take up a lot of space and will bloat your minified file.
|
||||
At the time of writing, all the translations add about 50KB of extra data to
|
||||
the minified javascript file. Therefore, make sure to only
|
||||
include those languages which you intend to support and remove from
|
||||
./src/locales.js those which you don't need. Remember to rebuild the
|
||||
minified file afterwards, by running `make build`.
|
||||
Converse.js supports localization of its user interface and date formats. As
|
||||
of writing, 17 languages are supported.
|
||||
|
||||
The translations of converse.js can be found in the `locale
|
||||
<https://github.com/jcbrand/converse.js/tree/master/locale>`_ directory.
|
||||
|
||||
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)
|
||||
----------------------------------------------
|
||||
|
||||
|
@ -38,8 +61,6 @@ After adding the string, you'll need to regenerate the POT file:
|
|||
|
||||
make pot
|
||||
|
||||
|
||||
-------------------------------------------
|
||||
Making translations file for a new language
|
||||
-------------------------------------------
|
||||
|
||||
|
@ -64,7 +85,6 @@ the JavaScript translations library that we're using.
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"plural_forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
--------------------------------------
|
||||
Updating an existing translations file
|
||||
--------------------------------------
|
||||
|
||||
|
@ -84,8 +104,6 @@ To do this for ALL languages, run:
|
|||
|
||||
The resulting `.po` file is then what gets translated.
|
||||
|
||||
|
||||
-----------------------------------------------------
|
||||
Generating a JavaScript file from a translations file
|
||||
-----------------------------------------------------
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
"jquery.noconflict",
|
||||
"backbone.browserStorage",
|
||||
"backbone.overview",
|
||||
"moment_with_locales",
|
||||
"moment",
|
||||
"strophe",
|
||||
"strophe.disco",
|
||||
"strophe.rsm",
|
||||
|
|
|
@ -35,7 +35,6 @@ 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",
|
||||
"sizzle": "node_modules/jquery/sizzle/dist/sizzle",
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"polyfill",
|
||||
"i18n",
|
||||
"utils",
|
||||
"moment_with_locales",
|
||||
"moment",
|
||||
"strophe",
|
||||
"pluggable",
|
||||
"backbone.noconflict",
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
define('lodash', [], function () { return _; });
|
||||
define('lodash.converter', [], function () { return fp; });
|
||||
define('lodash.noconflict', [], function () { return _; });
|
||||
define('moment_with_locales', [], function () { return moment; });
|
||||
define('strophe', [], function () {
|
||||
return {
|
||||
'Strophe': Strophe,
|
||||
|
|
18
src/i18n.js
18
src/i18n.js
|
@ -13,7 +13,23 @@
|
|||
"es6-promise",
|
||||
"jed",
|
||||
"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);
|
||||
}(this, function (Promise, Jed, _, moment) {
|
||||
'use strict';
|
||||
|
|
Loading…
Reference in New Issue