Skip to content

Commit

Permalink
README update
Browse files Browse the repository at this point in the history
  • Loading branch information
vint21h committed Feb 27, 2020
1 parent 12a73fd commit 93780bc
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 6 deletions.
46 changes: 40 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
A django-po2xls documentation
=============================

*django-po2xls is a django management command to convert project translation .po files to .xls*
|Travis|_ |Coveralls|_ |Requires|_ |pypi-license|_ |pypi-version|_ |pypi-python-version|_ |pypi-django-version|_ |pypi-format|_ |pypi-wheel|_ |pypi-status|_

*django-po2xls is a Django management command to convert project translation .po files to .xls*

.. contents::

Expand All @@ -14,23 +16,23 @@ django-po2xls does not support plural.

Installation
------------
* Obtain your copy of source code from the git repository: ``git clone https://github.com/vint21h/django-po2xls.git``. Or download the latest release from https://github.com/vint21h/django-po2xls/tags/.
* Run ``python ./setup.py install`` from repository source tree or unpacked archive. Or use pip: ``pip install django-po2xls``.
* Obtain your copy of source code from the git repository: ``$ git clone https://github.com/vint21h/django-po2xls.git``. Or download the latest release from https://github.com/vint21h/django-po2xls/tags/.
* Run ``$ python ./setup.py install`` from the repository source tree or unpacked archive. Or use pip: ``$ pip install django-po2xls``.

Configuration
-------------
Add ``"po2xls"`` to ``settings.INSTALLED_APPS``.

.. code-block:: python
INSTALLED_APPS += (
INSTALLED_APPS += [
"po2xls",
)
]
Usage
-----
Just run ``po-to-xls`` django management command and .xls files dropped near all of your project .po files.
Just run: ``$ python ./manage.py po-to-xls`` Django management command from project folder and .xls files will be dropped near all of your project .po files.

Licensing
---------
Expand All @@ -44,3 +46,35 @@ Contacts
**Author**: Alexei Andrushievich <vint21h@vint21h.pp.ua>

For other authors list see AUTHORS file.


.. |Travis| image:: https://travis-ci.org/vint21h/django-po2xls.svg?branch=master
:alt: Travis
.. |Coveralls| image:: https://coveralls.io/repos/github/vint21h/django-po2xls/badge.svg?branch=master
:alt: Coveralls
.. |Requires| image:: https://requires.io/github/vint21h/django-po2xls/requirements.svg?branch=master
:alt: Requires
.. |pypi-license| image:: https://img.shields.io/pypi/l/django-po2xls
:alt: License
.. |pypi-version| image:: https://img.shields.io/pypi/v/django-po2xls
:alt: Version
.. |pypi-django-version| image:: https://img.shields.io/pypi/djversions/django-po2xls
:alt: Supported Django version
.. |pypi-python-version| image:: https://img.shields.io/pypi/pyversions/django-po2xls
:alt: Supported Python version
.. |pypi-format| image:: https://img.shields.io/pypi/format/django-po2xls
:alt: Package format
.. |pypi-wheel| image:: https://img.shields.io/pypi/wheel/django-po2xls
:alt: Python wheel support
.. |pypi-status| image:: https://img.shields.io/pypi/status/django-po2xls
:alt: Package status
.. _Travis: https://travis-ci.org/vint21h/django-po2xls/
.. _Coveralls: https://coveralls.io/github/vint21h/django-po2xls?branch=master
.. _Requires: https://requires.io/github/vint21h/django-po2xls/requirements/?branch=master
.. _pypi-license: https://pypi.org/project/django-po2xls/
.. _pypi-version: https://pypi.org/project/django-po2xls/
.. _pypi-django-version: https://pypi.org/project/django-po2xls/
.. _pypi-python-version: https://pypi.org/project/django-po2xls/
.. _pypi-format: https://pypi.org/project/django-po2xls/
.. _pypi-wheel: https://pypi.org/project/django-po2xls/
.. _pypi-status: https://pypi.org/project/django-po2xls/
10 changes: 10 additions & 0 deletions tests/management/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-

# django-po2xls
# tests/management/__init__.py


from typing import List # pylint: disable=W0611


__all__ = [] # type: List[str]
10 changes: 10 additions & 0 deletions tests/management/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-

# django-po2xls
# tests/management/commands/__init__.py


from typing import List # pylint: disable=W0611


__all__ = [] # type: List[str]
45 changes: 45 additions & 0 deletions tests/management/commands/test_po-to-xls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-

# django-po2xls
# tests/management/commands/test_po-to-xls.py


from importlib import import_module
import os
import pathlib
from typing import List # pylint: disable=W0611

from django.test import TestCase


Command = import_module("po2xls.management.commands.po-to-xls").Command # type: ignore


__all__ = ["CommandTest"] # type: List[str]


class CommandTest(TestCase):
"""
po-to-xls management command tests.
"""

@classmethod
def tearDownClass(cls):
"""
Tear down.
"""

os.remove("po2xls/locale/uk/LC_MESSAGES/django.xls")

super().tearDownClass()

def test_convert(self):
"""
convert method must write converted data to .xls files for chosen locale.
"""

Command().convert(locale="uk")

self.assertTrue(
expr=pathlib.Path("po2xls/locale/uk/LC_MESSAGES/django.xls").exists()
)
1 change: 1 addition & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
LANGUAGE_CODE = "en" # type: str
LANGUAGES = [("en", "English"), ("uk", "Українська")] # type: Iterable[Tuple[str, str]]
DEFAULT_LANGUAGE = "en" # type: str
LOCALE_PATHS = ["po2xls/locale"] # type: List[str]

# add testing related apps
INSTALLED_APPS = [
Expand Down

0 comments on commit 93780bc

Please sign in to comment.