Commit 55766572 authored by Michal Čihař's avatar Michal Čihař

Added support for javascript-format used in Gettext PO.

Current gettext seems to use javascript-format instead of c-format for
javascript files. The format string is more or less compatible.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 92f633ff
......@@ -32,10 +32,10 @@ list of flags accepted:
``rst-text``
Treat text as RST document, affects :ref:`check-same`.
``python-format``, ``c-format``, ``php-format``, ``python-brace-format``
``python-format``, ``c-format``, ``php-format``, ``python-brace-format``, ``javascript-format``
Treats all string like format strings, affects :ref:`check-python-format`,
:ref:`check-c-format`, :ref:`check-php-format`,
:ref:`check-python-brace-format`, :ref:`check-same`.
:ref:`check-python-brace-format`, :ref:`javascript-format`, :ref:`check-same`.
``ignore-end-space``
Skip the "Trailing space" quality check.
``ignore-inconsistent``
......@@ -60,6 +60,8 @@ list of flags accepted:
Skip the "Trailing newline" quality check.
``ignore-c-format``
Skip the "C format" quality check.
``ignore-javascript-format``
Skip the "Javascript format" quality check.
``ignore-optional-plural``
Skip the "Optional plural" quality check.
``ignore-end-exclamation``
......
......@@ -109,6 +109,7 @@ For example you can enable only few of them:
'weblate.trans.checks.format.PythonBraceFormatCheck',
'weblate.trans.checks.format.PHPFormatCheck',
'weblate.trans.checks.format.CFormatCheck',
'weblate.trans.checks.format.JavascriptFormatCheck',
'weblate.trans.checks.consistency.PluralsCheck',
'weblate.trans.checks.consistency.ConsistencyCheck',
'weblate.trans.checks.chars.NewlineCountingCheck',
......
......@@ -20,6 +20,7 @@ Released on ? 2015.
* Added support for error reporting to Rollbar.
* Projects now can have multiple owners.
* Project owners can manage themselves.
* Added support for javascript-format used in Gettext PO.
weblate 2.3
-----------
......
......@@ -146,6 +146,7 @@ when the original string was using that as well.
.. _check-python-brace-format:
.. _check-php-format:
.. _check-c-format:
.. _check-javascript-format:
Format strings
~~~~~~~~~~~~~~
......@@ -156,6 +157,7 @@ Format string does not match source. Weblate supports following formats:
* Python brace format
* PHP format
* C format
* Javascript format
Omitting format string from translation usually cause severe problems, so you
should really keep the format string matching the original one.
......
......@@ -114,6 +114,7 @@ CHECK_LIST = getvalue('CHECK_LIST', (
'weblate.trans.checks.format.PythonBraceFormatCheck',
'weblate.trans.checks.format.PHPFormatCheck',
'weblate.trans.checks.format.CFormatCheck',
'weblate.trans.checks.format.JavascriptFormatCheck',
'weblate.trans.checks.consistency.PluralsCheck',
'weblate.trans.checks.consistency.ConsistencyCheck',
'weblate.trans.checks.chars.NewlineCountingCheck',
......
......@@ -477,6 +477,7 @@ CRISPY_TEMPLATE_PACK = 'bootstrap3'
# 'weblate.trans.checks.format.PythonBraceFormatCheck',
# 'weblate.trans.checks.format.PHPFormatCheck',
# 'weblate.trans.checks.format.CFormatCheck',
# 'weblate.trans.checks.format.JavascriptFormatCheck',
# 'weblate.trans.checks.consistency.PluralsCheck',
# 'weblate.trans.checks.consistency.ConsistencyCheck',
# 'weblate.trans.checks.chars.NewlineCountingCheck',
......
......@@ -253,6 +253,14 @@ class CFormatCheck(BaseFormatCheck):
return True
class JavascriptFormatCheck(CFormatCheck):
'''
Check for Javascript format string
'''
check_id = 'javascript_format'
name = _('Javascript format')
class PythonBraceFormatCheck(BaseFormatCheck):
'''
Check for Python format string
......
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