Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(i18n): migrate from POEditor to Weblate #170

Merged
merged 1 commit into from
May 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ jobs:
changelog="${changelog//$'\n'/'%0A'}"
changelog="${changelog//$'\r'/'%0D'}"
echo "::set-output name=changelog::$changelog"
- name: Build locales
env:
POEDITOR_API_ACCESS: ${{ secrets.POEDITOR_API_ACCESS }}
run: |
make POEDITOR_API_ACCESS="${POEDITOR_API_ACCESS}" i18n
tar cf locales.tar.gz kosmorrolib/locales
- name: Create release
id: create_release
uses: actions/create-release@v1
Expand All @@ -42,19 +36,8 @@ jobs:
prerelease: false
body: |
${{ steps.prepare_release.outputs.changelog }}
- name: Upload locales
id: upload-locales
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./locales.tar.gz
asset_name: locales.tar.gz
asset_content_type: application/x-tar


pip:
pipy:
name: Release to PyPI
runs-on: ubuntu-latest
steps:
Expand All @@ -76,9 +59,7 @@ jobs:
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
POEDITOR_API_ACCESS: ${{ secrets.POEDITOR_API_ACCESS }}
POEDITOR_PROJECT_ID: 306433
run: |
make POEDITOR_API_ACCESS="${POEDITOR_API_ACCESS}" POEDITOR_PROJECT_ID="306433" build
make i18n build
twine upload dist/*

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ coverage.xml
/manpage/*
!/manpage/*.md

# Translation files are taken care on https://poeditor.com/join/project/GXuhLpdaoh
# Compiled internationalization files
*.mo
*.po
52 changes: 0 additions & 52 deletions .scripts/build/getlangs.py

This file was deleted.

8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ First, please check someone didn't suggest your next revolution in the _Issues_

## Translating

If you speak another language than English, another nice way to enhance Kosmorro is to translate its messages. The recommended way to begin translating Kosmorro is to [join the POEditor team](https://poeditor.com/join/project/GXuhLpdaoh).
If you speak another language than English, another nice way to enhance Kosmorro is to translate its messages. The recommended way to begin translating Kosmorro is to [join the Weblate project](https://hosted.weblate.org/engage/kosmorro/).

## Writing code

Expand All @@ -44,7 +44,7 @@ The messages file contains all the messages Kosmorro can display, in order to ma
When you add a new string that will be displayed to the end user, please pass it to the `_()` function made available in the `kosmorrolib.i18n` package, for instance:

```python
# Dont:
# Don't:
print('Note: All the hours are given in UTC.')

# Do:
Expand All @@ -57,10 +57,10 @@ This will allow Python's internationalization tool to translate the string in an
Once you have done your work, please remember to tell [Babel](http://babel.pocoo.org) to extract the new strings:

```console
$ pipenv run python setup.py extract_messages --output-file=kosmorrolib/locales/messages.pot
$ make messages
```

> If the `setup.py` script tells you that the `extract_messages` command does not exist, then run `kosmorro sync` to ensure all the dev dependencies are installed and try again.
> If the `setup.py` script tells you that the `extract_messages` command does not exist, then run `pipenv sync` to ensure all the dev dependencies are installed and try again.

Note that if you forget to update the messages file, the CI will fail.

Expand Down
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test:
unset KOSMORRO_TIMEZONE; \
LANG=C pipenv run python3 -m coverage run -m unittest test

build: i18n manpages
build: manpages
python3 setup.py sdist bdist_wheel

messages:
Expand All @@ -19,10 +19,7 @@ manpages:
ronn --roff manpage/kosmorro.7.md

i18n:
if [ "$$POEDITOR_API_ACCESS" != "" ]; then \
python3 .scripts/build/getlangs.py; \
python3 setup.py compile_catalog; \
fi
python3 setup.py compile_catalog; \

env:
@if [[ "$$RELEASE_NUMBER" == "" ]]; \
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ![Kosmorro](kosmorrolib/assets/png/kosmorro-logo.png)
[![Coverage Status](https://coveralls.io/repos/github/Kosmorro/kosmorro/badge.svg?branch=master)](https://coveralls.io/github/Kosmorro/kosmorro?branch=master) [![Version on PyPI](https://img.shields.io/pypi/v/kosmorro)](https://pypi.org/project/kosmorro) [![Discord](https://img.shields.io/discord/650237632533757965?logo=discord&label=%23kosmorro)](https://discord.gg/TVX4MSKGaa) ![Docker Pulls](https://img.shields.io/docker/pulls/kosmorro/kosmorro)
[![Coverage Status](https://coveralls.io/repos/github/Kosmorro/kosmorro/badge.svg?branch=master)](https://coveralls.io/github/Kosmorro/kosmorro?branch=master) [![Version on PyPI](https://img.shields.io/pypi/v/kosmorro)](https://pypi.org/project/kosmorro) [![Discord](https://img.shields.io/discord/650237632533757965?logo=discord&label=%23kosmorro)](https://discord.gg/TVX4MSKGaa) ![Docker Pulls](https://img.shields.io/docker/pulls/kosmorro/kosmorro) [![Help translating Kosmorro!](https://hosted.weblate.org/widgets/kosmorro/-/cli/svg-badge.svg)](https://hosted.weblate.org/engage/kosmorro/)

A program that calculates your astronomical ephemerides!

Expand Down Expand Up @@ -98,3 +98,10 @@ Before you use this feature, make sure you have installed a LaTeX distribution:
- with Brew: `brew install basictex`

These dependencies are not installed by default, because they take a lot of place and are not necessary if you are not interested in generating PDF files.

## Help translating Kosmorro!

Kosmorro is translated on [Weblate](https://hosted.weblate.org/engage/kosmorro/), a popular free platform for crowd-sourced internationalization.
If you speak a language that is not supported yet, feel free to contribute!

![Translation state per language](https://hosted.weblate.org/widgets/kosmorro/-/cli/multi-auto.svg)