Skip to content

Commit 7e9792c

Browse files
committed
Fix translations support.
1 parent fea4285 commit 7e9792c

File tree

25 files changed

+472
-92
lines changed

25 files changed

+472
-92
lines changed

.travis.yml

+28-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
# Config file for automatic testing at travis-ci.org
2-
# This file will be regenerated if you run travis_pypi_setup.py
3-
4-
language: python
5-
python: 3.5
6-
1+
# This file was autogenerated and will overwrite each time you run travis_pypi_setup.py
2+
deploy:
3+
distributions: sdist bdist_wheel
4+
provider: pypi
5+
user: sophilabs
6+
password:
7+
secure: !!binary |
8+
R08xa2p1aXl2NStFaW5wT0QyeXZCeUNiYVhOUjRxTFRpTGdTTDB0TjM2eTdWMmRWY3RvS2gzS29U
9+
cmZCb3pQekgvOTNPT2s4S1U0T1ZDNUVXWDRITzYvaGRheXQ2MWpGQzFQRFVSZ3pnaUxRUUJMeWV5
10+
UU10bno1cktGcTMxamRsM0pjSFJFclRBQ0FDWkJ5a2J1a2JNZENNZUg4S29GN1dCSVhxL3g4OG9L
11+
RXQ2RjJLV0cyT2pYUEpnaUppTThhVXhxWnJ3NS81b1FGS3NaY1ovQnlpRzg3RlNuU2FYSlMwV0NY
12+
dWN0UG0wUE80a2E3UHNQS2oyUFdzdndKS0F5VUswSnhUSlAxK3kzOUYwSkRsaXh6VXE1My9WdXI5
13+
cXFsdmZvbElwQlVJWmpNN3BTSmRoeVBiTmlER25rTHJyUWxYWExSbDZFQVlKQ045Zk1Jd3ZXUktX
14+
bDdIdXZSYnVwRjNzb1d5WElQOTUycXU5eXRlOGJ3K3paN3RDTGNPcHFzcFU0TWNVQkNITU5KMzlh
15+
U2x4ZWhYbHBabFI1TUNmRUlJNm1kaG9rcHBja2JlT2p4cVVPSTJsdjk2Y2tvK1JScG9CanhPdXRx
16+
RTl6ZG9EcHN2Rnk0enl5cEpBWm1oQXc1OXc1K2VaNHpXcTFjUVREUEF1MEtuQmllU2kyVjdSN3FX
17+
cGIvTDJYRXZ5NmVMaVBVMU41dlBLanVNZ1Y3RHlPMzc2VzVFMXJ0V1RmeTh2MFpETmlISnF4cmFQ
18+
MDZUamlvMm1zU1VIbmpTWXFjU0VSdzJqOElMakpsa2RPNFZGYTY1SlRVNzJobWJFbXZHZDdGZUtC
19+
UEhYZnR4SUVFTHlkR205eFo3VE1pS2w5c0duQzM1MzVmZEFyNVk4VVZSOFFRUndGN05MdTFFMDA9
20+
true:
21+
condition: $TOXENV == py33
22+
repo: sophilabs/learnregex
23+
tags: true
724
env:
8-
- TOXENV=py35
9-
- TOXENV=py34
10-
- TOXENV=py33
11-
- TOXENV=py27
12-
- TOXENV=py26
13-
- TOXENV=pypy
14-
15-
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
25+
- TOXENV=py35
26+
- TOXENV=py34
27+
- TOXENV=py33
1628
install: pip install -U tox
17-
18-
# command to run tests, e.g. python setup.py test
29+
language: python
30+
python: 3.5
1931
script: tox -e ${TOXENV}
20-
21-

AUTHORS.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Credits
55
Development Lead
66
----------------
77

8-
* Sophilabs <hi@sophilabs.co>
8+
* Javier Ayres <jayres@sophilabs.com>
99

1010
Contributors
1111
------------
1212

13-
* Javier Ayres <jayres@sophilabs.com>
13+
* Pablo Ricco <pricco@sophilabs.com>

CONTRIBUTING.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Types of Contributions
1515
Report Bugs
1616
~~~~~~~~~~~
1717

18-
Report bugs at https://github.com/lufte/learnregex/issues.
18+
Report bugs at https://github.com/sophilabs/learnregex/issues.
1919

2020
If you are reporting a bug, please include:
2121

@@ -45,7 +45,7 @@ articles, and such.
4545
Submit Feedback
4646
~~~~~~~~~~~~~~~
4747

48-
The best way to send feedback is to file an issue at https://github.com/lufte/learnregex/issues.
48+
The best way to send feedback is to file an issue at https://github.com/sophilabs/learnregex/issues.
4949

5050
If you are proposing a feature:
5151

@@ -102,7 +102,7 @@ Before you submit a pull request, check that it meets these guidelines:
102102
your new functionality into a function with a docstring, and add the
103103
feature to the list in README.rst.
104104
3. The pull request should work for Python 2.6, 2.7, 3.3, 3.4 and 3.5, and for PyPy. Check
105-
https://travis-ci.org/lufte/learnregex/pull_requests
105+
https://travis-ci.org/sophilabs/learnregex/pull_requests
106106
and make sure that the tests pass for all supported Python versions.
107107

108108
Tips

Makefile

+63-30
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: clean clean-test clean-pyc clean-build docs help
1+
.PHONY: clean clean-test clean-pyc clean-build help
22
.DEFAULT_GOAL := help
33
define BROWSER_PYSCRIPT
44
import os, webbrowser, sys
@@ -21,69 +21,102 @@ for line in sys.stdin:
2121
print("%-20s %s" % (target, help))
2222
endef
2323
export PRINT_HELP_PYSCRIPT
24+
2425
BROWSER := python -c "$$BROWSER_PYSCRIPT"
26+
VERSION=$(shell grep __version__ learnregex/__init__.py)
27+
REQUIREMENTS="requirements_dev.pip"
28+
TAG="\n\n\033[0;32m\#\#\# "
29+
END=" \#\#\# \033[0m\n"
30+
31+
all: test
2532

2633
help:
2734
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
2835

2936
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
3037

31-
32-
clean-build: ## remove build artifacts
38+
clean-build:
39+
@echo $(TAG)Remove build artifacts$(END)
3340
rm -fr build/
3441
rm -fr dist/
3542
rm -fr .eggs/
3643
find . -name '*.egg-info' -exec rm -fr {} +
3744
find . -name '*.egg' -exec rm -f {} +
45+
@echo
3846

39-
clean-pyc: ## remove Python file artifacts
47+
clean-pyc:
48+
@echo $(TAG)Remove Python file artifacts$(END)
4049
find . -name '*.pyc' -exec rm -f {} +
4150
find . -name '*.pyo' -exec rm -f {} +
4251
find . -name '*~' -exec rm -f {} +
4352
find . -name '__pycache__' -exec rm -fr {} +
53+
@echo
4454

45-
clean-test: ## remove test and coverage artifacts
55+
clean-test:
56+
@echo $(TAG)Remove test and coverage artifacts$(END)
4657
rm -fr .tox/
4758
rm -f .coverage
4859
rm -fr htmlcov/
60+
@echo
4961

50-
lint: ## check style with flake8
62+
lint:
63+
@echo $(TAG)Remove test and coverage artifacts$(END)
5164
flake8 learnregex tests
52-
53-
test: ## run tests quickly with the default Python
54-
55-
python setup.py test
56-
57-
test-all: ## run tests on every Python version with tox
65+
@echo
66+
67+
msg-init:
68+
@echo $(TAG)Initializing messages$(END)
69+
pybabel init -D pyschool -i learnregex/locale/learnregex.pot -d learnregex/locale -l en
70+
pybabel init -D pyschool -i learnregex/locale/learnregex.pot -d learnregex/locale -l es
71+
@echo
72+
73+
msg-extract:
74+
@echo $(TAG)Extracting messages$(END)
75+
pybabel extract -o learnregex/locale/learnregex.pot learnregex
76+
pybabel update -D pyschool -i learnregex/locale/learnregex.pot -d learnregex/locale -l en
77+
pybabel update -D pyschool -i learnregex/locale/learnregex.pot -d learnregex/locale -l es
78+
@echo
79+
80+
msg-compile:
81+
@echo $(TAG)Compiling messages$(END)
82+
pybabel compile -D pyschool -d learnregex/locale -f --statistics
83+
@echo
84+
85+
msg: msg-extract msg-compile
86+
87+
test:
88+
@echo $(TAG)Run tests quickly with the default Python$(END)
89+
PYTHONPATH=. py.test ./tests
90+
@echo
91+
92+
test-all:
93+
@echo $(TAG)Run tests on every Python version with tox$(END)
5894
tox
95+
@echo
96+
97+
coverage:
98+
@echo $(TAG)Check code coverage quickly with the default Python$(END)
99+
coverage run --source learnregex -m pytest
59100

60-
coverage: ## check code coverage quickly with the default Python
61-
62-
coverage run --source learnregex setup.py test
63-
64101
coverage report -m
65102
coverage html
66103
$(BROWSER) htmlcov/index.html
104+
@echo
67105

68-
docs: ## generate Sphinx HTML documentation, including API docs
69-
rm -f docs/learnregex.rst
70-
rm -f docs/modules.rst
71-
sphinx-apidoc -o docs/ learnregex
72-
$(MAKE) -C docs clean
73-
$(MAKE) -C docs html
74-
$(BROWSER) docs/_build/html/index.html
75-
76-
servedocs: docs ## compile the docs watching for changes
77-
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
78-
79-
release: clean ## package and upload a release
106+
release: clean
107+
@echo $(TAG)Package and upload a release$(END)
80108
python setup.py sdist upload
81109
python setup.py bdist_wheel upload
110+
@echo
82111

83-
dist: clean ## builds source and wheel package
112+
dist: clean
113+
@echo $(TAG)Builds source and wheel package$(END)
84114
python setup.py sdist
85115
python setup.py bdist_wheel
86116
ls -l dist
117+
@echo
87118

88-
install: clean ## install the package to the active Python's site-packages
119+
install: clean
120+
@echo $(TAG)Install the package to the active Python site-packages$(END)
89121
python setup.py install
122+
@echo

README.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ learnregex
66
.. image:: https://img.shields.io/pypi/v/learnregex.svg
77
:target: https://pypi.python.org/pypi/learnregex
88

9-
.. image:: https://img.shields.io/travis/lufte/learnregex.svg
10-
:target: https://travis-ci.org/lufte/learnregex
9+
.. image:: https://img.shields.io/travis/sophilabs/learnregex.svg
10+
:target: https://travis-ci.org/sophilabs/learnregex
1111

1212
.. image:: https://readthedocs.org/projects/learnregex/badge/?version=latest
1313
:target: https://learnregex.readthedocs.io/en/latest/?badge=latest
1414
:alt: Documentation Status
1515

16-
.. image:: https://pyup.io/repos/github/lufte/learnregex/shield.svg
17-
:target: https://pyup.io/repos/github/lufte/learnregex/
16+
.. image:: https://pyup.io/repos/github/sophilabs/learnregex/shield.svg
17+
:target: https://pyup.io/repos/github/sophilabs/learnregex/
1818
:alt: Updates
1919

2020

learnregex/alternation/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import random
22

33
from story.adventures import AdventureVerificationError, BaseAdventure
4+
from story.translation import gettext as _
45

5-
from ..data import _
66
from ..utils import load_solution_function
77

88

learnregex/anchors/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import string
22

33
from story.adventures import AdventureVerificationError, BaseAdventure
4+
from story.translation import gettext as _
45

5-
from ..data import _
66
from ..utils import get_random_string, load_solution_function
77

88

learnregex/capturing/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import string
22

33
from story.adventures import AdventureVerificationError, BaseAdventure
4+
from story.translation import gettext as _
45

5-
from ..data import _
66
from ..utils import get_random_string, load_solution_function
77

88

learnregex/character_classes/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import string
33

44
from story.adventures import AdventureVerificationError, BaseAdventure
5+
from story.translation import gettext as _
56

6-
from ..data import _
77
from ..utils import get_random_string, load_solution_function
88

99

learnregex/data.py

-11
This file was deleted.

learnregex/greediness/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import string
22

33
from story.adventures import AdventureVerificationError, BaseAdventure
4+
from story.translation import gettext as _
45

5-
from ..data import _
66
from ..utils import get_random_string, load_solution_function
77

88

learnregex/groups/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import random
22

33
from story.adventures import AdventureVerificationError, BaseAdventure
4+
from story.translation import gettext as _
45

5-
from ..data import _
66
from ..utils import load_solution_function
77

88

learnregex/introduction/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from story.adventures import AdventureVerificationError, BaseAdventure
2+
from story.translation import gettext as _
23

3-
from ..data import _
44
from ..utils import load_solution_function
55

66

0 commit comments

Comments
 (0)