# Msgcheck
[![PyPI](https://img.shields.io/pypi/v/msgcheck.svg)](https://pypi.org/project/msgcheck/)
[![Build Status](https://github.com/flashcode/msgcheck/workflows/CI/badge.svg)](https://github.com/flashcode/msgcheck/actions?query=workflow%3A%22CI%22)
[![Build Status](https://github.com/flashcode/msgcheck/workflows/CodeQL/badge.svg)](https://github.com/flashcode/msgcheck/actions?query=workflow%3A%22CodeQL%22)
Msgcheck performs various checks on gettext files (with extension `.po`):
- compilation (with command `msgfmt -c`)
- for each translation:
- number of lines in translated strings
- whitespace at beginning/end of strings
- trailing whitespace at end of lines inside strings
- punctuation at end of strings
- spelling (messages and translations).
The script requires:
- Python ≥ 3.6
- gettext (for the command `msgfmt`, used to compile PO files)
- the python module `pyenchant` if spelling is checked (with option `-s`).
## Install
Install a released version from the Python package index with pip:
```
$ pip install msgcheck
```
Or you can install via source distribution:
```
$ python setup.py install
```
## Usage
Syntax:
```
$ msgcheck [options] file.po [file.po...]
```
Options:
- `-h`, `--help`: display help message and exit
- `-c`, `--no-compile`: do not check compilation of file (with `msgfmt -c`)
- `-f`, `--fuzzy`: check fuzzy strings
- `-n`, `--check-noqa`: check "noqa"-commented lines (they are skipped by default)
- `-l`, `--no-lines`: do not check number of lines
- `-p`, `--no-punct`: do not check punctuation at end of strings
- `-s id|str`, `--spelling id|str`: check spelling (`id` = source messages, `str` = translations)
- `-d <dicts>`, `--dicts <dicts>`: comma-separated list of extra dictionaries to use (in addition to file language)
- `-P <file>`, `--pwl <file>`: file(s) with personal list of words used when checking spelling (this option can be given multiple times)
- `-m`, `--only-misspelled`: display only misspelled words (no error, line number and translation)
- `-w`, `--no-whitespace`: do not check whitespace at beginning/end of strings
- `-W`, `--no-whitespace-eol`: do not check whitespace at end of lines inside strings
- `-e`, `--extract`: display all translations and exit (all checks except compilation are disabled in this mode)
- `-i`, `--ignore-errors`: display but ignore errors (always return 0)
- `-q`, `--quiet`: quiet mode: only display number of errors
- `-v`, `--version`: display version and exit
The environment variable `MSGCHECK_OPTIONS` can be set with some default options.
The script returns exit code **0** if all files checked are OK (0 errors or option
`--extract` given) or it returns **N**: number of files with errors (1 ≤ N ≤ 255).
## Example
```
$ msgcheck fr.po
======================================================================
/path/to/fr.po:242: [punct] end punctuation: ":" in translation, ":" not in string:
---
error
---
erreur:
======================================================================
/path/to/fr.po:262: [lines] number of lines: 1 in string, 2 in translation:
---
Message filters:
---
Filtres de
messages:
======================================================================
/path/to/fr.po:336: [whitespace] spaces at beginning: 0 in string, 1 in translation:
---
current value
---
valeur courante
======================================================================
/path/to/fr.po: 3 errors (almost good!)
```
## Copyright
Copyright © 2009-2024 [Sébastien Helleu](https://github.com/flashcode)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Raw data
{
"_id": null,
"home_page": "https://github.com/flashcode/msgcheck",
"name": "msgcheck",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "gettext",
"author": "S\u00e9bastien Helleu",
"author_email": "flashcode@flashtux.org",
"download_url": null,
"platform": null,
"description": "# Msgcheck\n\n[![PyPI](https://img.shields.io/pypi/v/msgcheck.svg)](https://pypi.org/project/msgcheck/)\n[![Build Status](https://github.com/flashcode/msgcheck/workflows/CI/badge.svg)](https://github.com/flashcode/msgcheck/actions?query=workflow%3A%22CI%22)\n[![Build Status](https://github.com/flashcode/msgcheck/workflows/CodeQL/badge.svg)](https://github.com/flashcode/msgcheck/actions?query=workflow%3A%22CodeQL%22)\n\nMsgcheck performs various checks on gettext files (with extension `.po`):\n\n- compilation (with command `msgfmt -c`)\n- for each translation:\n - number of lines in translated strings\n - whitespace at beginning/end of strings\n - trailing whitespace at end of lines inside strings\n - punctuation at end of strings\n - spelling (messages and translations).\n\nThe script requires:\n\n- Python \u2265 3.6\n- gettext (for the command `msgfmt`, used to compile PO files)\n- the python module `pyenchant` if spelling is checked (with option `-s`).\n\n## Install\n\nInstall a released version from the Python package index with pip:\n\n```\n$ pip install msgcheck\n```\n\nOr you can install via source distribution:\n\n```\n$ python setup.py install\n```\n\n## Usage\n\nSyntax:\n\n```\n$ msgcheck [options] file.po [file.po...]\n```\n\nOptions:\n\n- `-h`, `--help`: display help message and exit\n- `-c`, `--no-compile`: do not check compilation of file (with `msgfmt -c`)\n- `-f`, `--fuzzy`: check fuzzy strings\n- `-n`, `--check-noqa`: check \"noqa\"-commented lines (they are skipped by default)\n- `-l`, `--no-lines`: do not check number of lines\n- `-p`, `--no-punct`: do not check punctuation at end of strings\n- `-s id|str`, `--spelling id|str`: check spelling (`id` = source messages, `str` = translations)\n- `-d <dicts>`, `--dicts <dicts>`: comma-separated list of extra dictionaries to use (in addition to file language)\n- `-P <file>`, `--pwl <file>`: file(s) with personal list of words used when checking spelling (this option can be given multiple times)\n- `-m`, `--only-misspelled`: display only misspelled words (no error, line number and translation)\n- `-w`, `--no-whitespace`: do not check whitespace at beginning/end of strings\n- `-W`, `--no-whitespace-eol`: do not check whitespace at end of lines inside strings\n- `-e`, `--extract`: display all translations and exit (all checks except compilation are disabled in this mode)\n- `-i`, `--ignore-errors`: display but ignore errors (always return 0)\n- `-q`, `--quiet`: quiet mode: only display number of errors\n- `-v`, `--version`: display version and exit\n\nThe environment variable `MSGCHECK_OPTIONS` can be set with some default options.\n\nThe script returns exit code **0** if all files checked are OK (0 errors or option\n`--extract` given) or it returns **N**: number of files with errors (1 \u2264 N \u2264 255).\n\n## Example\n\n```\n$ msgcheck fr.po\n======================================================================\n/path/to/fr.po:242: [punct] end punctuation: \":\" in translation, \":\" not in string:\n---\nerror\n---\nerreur:\n======================================================================\n/path/to/fr.po:262: [lines] number of lines: 1 in string, 2 in translation:\n---\nMessage filters:\n---\nFiltres de\nmessages:\n======================================================================\n/path/to/fr.po:336: [whitespace] spaces at beginning: 0 in string, 1 in translation:\n---\ncurrent value\n---\n valeur courante\n======================================================================\n/path/to/fr.po: 3 errors (almost good!)\n```\n\n## Copyright\n\nCopyright \u00a9 2009-2024 [S\u00e9bastien Helleu](https://github.com/flashcode)\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see <https://www.gnu.org/licenses/>.\n",
"bugtrack_url": null,
"license": "GPL3",
"summary": "Gettext file checker.",
"version": "4.1.0",
"project_urls": {
"Homepage": "https://github.com/flashcode/msgcheck"
},
"split_keywords": [
"gettext"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "25e5dcc016465289246288e352c54012d8db9544de52a413c08c19c2f808b7a1",
"md5": "502c340a3606689d9879ea3047eb0256",
"sha256": "9d1c0d4ac59ee50c8bc266ee0c0f4c1effa8a284c26d8f9c6e1b85f087a24674"
},
"downloads": -1,
"filename": "msgcheck-4.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "502c340a3606689d9879ea3047eb0256",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 25313,
"upload_time": "2024-10-23T19:00:08",
"upload_time_iso_8601": "2024-10-23T19:00:08.277648Z",
"url": "https://files.pythonhosted.org/packages/25/e5/dcc016465289246288e352c54012d8db9544de52a413c08c19c2f808b7a1/msgcheck-4.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-23 19:00:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "flashcode",
"github_project": "msgcheck",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "msgcheck"
}