Translating to your own language is perhaps the most useful thing you can do for the project currently, as Amazon rolls out more and more language support for Alexa.
Generally, have a look at tickets marked help wanted or good first issue.
Generally pull requests are accepted if they:
- Address a Github issue where the approach has been discussed
- Pass all automated tests and linting
- Don't reduce the test coverage
- Are clearly written, and in a Pythonic way
- Use the current (ever changing...) best practices for Alexa skills
- 🆕 use Python 3.5+ features where appropriate (in particular typing) 3.6 features can't currently be used for mqtt-squeeze.
The project is now Python 3.6+ only, and we use Tox Pipenv Poetry (see #114).
We use PyTest and plugins for testing. You can run tests with
poetry run pytest
Testing is very important in this project, and coverage is high. Please respect this!
Coverage is reported in Coveralls.
poetry run flake8 --statistics .
No output / error code means everything is good...
This is mostly automated now:
bin/build.sh
bin/release.sh 3.0
will create releases/squeeze-alexa-3.0.zip
(hopefully) suitable for upload to Github etc.
squeeze-alexa uses GNU gettext for its output. It's a little old-fashioned / troublesome at first, but it serves its purposes well.
Great! Follow these steps (imagine you are choosing Brazilian Portuguese, pt_BR
):
cd locale
LOCALE=pt_BR
mkdir -p $LOCALE/LC_MESSAGES
DOMAIN=squeeze-alexa
touch $LOCALE/LC_MESSAGES/$DOMAIN.po
This re-scans the source and recreates a master .pot
file, before then updating the translations files (.po
s).
bin/update-translations
You can edit the using any text editor, or use PoEdit, or any other gettext tools e.g.
This takes the .po
s and makes binary .mo
s that are necessary for gettext to work.
bin/compile-translations
Amazon changed the way they handle interaction. The original way (v0) used separate input for slots and utterances. In interaction model v1, among other changes, they've merged this into one big JSON which is probably easier in the long run.
squeeze-alexa (documentation) now "supports" both
- Refer to the v0 intents.json.
- Add an
utterances.txt
in the right locale directory e.g.metadata/intents/v0/locale/pt_BR/utterances.txt
(see German example) - Optional: do the same for the SLOT (genres, playlist names, player names etc)
- Create a new locale directory, e.g.
pt_BR
undermetadata/v1/locale
. - Translate the whole English file v1 intents.json to a copy of the same name under that new directory.
- Hopefully you opened a Github issue - if not, do this.
- Either
- attach the updated
.po
and utterances / intents files, or - create a fork in Github, branch, commit your new file(s) in Git, then make a Pull Request, mentioning the ticket number.
- attach the updated
- Make sure you've set
LOCALE
insettings.py
. - Make sure the directory is setup as above and you've definitely compiled it (i.e. there's a
.mo
file) - New versions of
squeeze-alexa
default to the source language (en_US
) if there is no translation found.
No problem. They'll come out in the source language (en
here).
This .po
header is probably missing:
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
xgettext
reformats source files to a maximum line width according to its settings.
See update-translations
for the setup.