Skip to content
Permalink
Browse files

Template localization (#3529)

* Localize Django templates
  • Loading branch information
Pomax committed Nov 14, 2019
1 parent 5c06fb6 commit 747cdfa824184602686239044282f3e737142604
Showing with 2,017 additions and 100 deletions.
  1. +0 −1 .gitignore
  2. +1 −0 .travis.yml
  3. +2 −0 CODEOWNERS
  4. +3 −2 README.md
  5. +36 −0 bin/post_compile
  6. +4 −0 dockerfiles/Dockerfile.python
  7. +0 −3 locales/en-US/general.properties
  8. +256 −0 network-api/locale/de/LC_MESSAGES/django.po
  9. +256 −0 network-api/locale/es/LC_MESSAGES/django.po
  10. +254 −0 network-api/locale/fr/LC_MESSAGES/django.po
  11. +256 −0 network-api/locale/pl/LC_MESSAGES/django.po
  12. +259 −0 network-api/locale/pt/LC_MESSAGES/django.po
  13. +259 −0 network-api/locale/pt_BR/LC_MESSAGES/django.po
  14. +259 −0 network-api/locale/templates/LC_MESSAGES/django.pot
  15. +11 −7 network-api/networkapi/settings.py
  16. +2 −1 network-api/networkapi/templates/404.html
  17. +1 −1 network-api/networkapi/templates/fragments/language_switcher.html
  18. +1 −1 network-api/networkapi/templates/pages/base.html
  19. +7 −5 network-api/networkapi/templates/partials/404.html
  20. +15 −15 network-api/networkapi/templates/partials/footer.html
  21. +7 −7 network-api/networkapi/templates/partials/primary_nav.html
  22. +2 −2 network-api/networkapi/wagtail_l10n_customization/wagtail_hooks.py
  23. +2 −2 network-api/networkapi/wagtailpages/templates/wagtailpages/bannered_campaign_page.html
  24. +3 −1 network-api/networkapi/wagtailpages/templates/wagtailpages/blocks/recent_blog_entries.html
  25. +6 −6 network-api/networkapi/wagtailpages/templates/wagtailpages/blog_page.html
  26. +2 −2 network-api/networkapi/wagtailpages/templates/wagtailpages/campaign_page.html
  27. +2 −2 network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/blog_card.html
  28. +15 −5 network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/featured_blogs.html
  29. +3 −1 network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/ih_cta.html
  30. +2 −2 network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/related_posts.html
  31. +8 −8 network-api/networkapi/wagtailpages/templates/wagtailpages/homepage.html
  32. +9 −5 network-api/networkapi/wagtailpages/templates/wagtailpages/index_page.html
  33. +3 −1 network-api/networkapi/wagtailpages/templates/wagtailpages/pages/load-more-regrets.html
  34. +5 −6 network-api/networkapi/wagtailpages/templates/wagtailpages/pages/youtube_regrets_page.html
  35. +7 −7 network-api/networkapi/wagtailpages/templates/wagtailpages/static/initiatives_page.html
  36. +2 −1 network-api/networkapi/wagtailpages/utils.py
  37. +57 −6 tasks.py
@@ -53,7 +53,6 @@ coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log
@@ -82,6 +82,7 @@ jobs:
- pipenv run python network-api/manage.py sync_page_translation_fields
- pipenv run python network-api/manage.py update_translation_fields
- pipenv run python network-api/manage.py load_fake_data
- pipenv run python network-api/manage.py compilemessages
script: npm run percy
- stage: Deploy
name: Deploy Maintenance page to S3
@@ -0,0 +1,2 @@
# Théo as main contact for string changes
network-api/locale/templates/LC_MESSAGES/* @TheoChevalier
@@ -26,15 +26,16 @@

## How to Setup your Dev Environment with Pipenv and Invoke

**Requirements**: [Node](https://nodejs.org), [npm](https://www.npmjs.com/), [git](https://git-scm.com/), [python3.6 or later](https://www.python.org/), [pip](https://pypi.python.org/pypi), [pipenv](https://docs.pipenv.org/), [invoke](https://www.pyinvoke.org/installing.html).
**Requirements**: [Node](https://nodejs.org), [npm](https://www.npmjs.com/), [git](https://git-scm.com/), [python3.6 or later](https://www.python.org/), [pip](https://pypi.python.org/pypi), [pipenv](https://docs.pipenv.org/), [invoke](https://www.pyinvoke.org/installing.html), [gettext](https://www.gnu.org/software/gettext/).

If you installed [Python with Homebrew](https://docs.brew.sh/Homebrew-and-Python), use `pip3 install` instead of `pip install` when installing the relevant requirements.

### Check your environment

- `python --version` should return 3.7 or higher,
- `pipenv --version` should return 11.10 or higher,
- `invoke --version` should return 0.22.1 or higher.
- `invoke --version` should return 0.22.1 or higher,
- `gettext --version` should return 0.20.1 or higher.

### Setup steps

@@ -0,0 +1,36 @@
#!/usr/bin/env bash

GETTEXT_SHA256="2f991a49b3fb616a032490c907cb700966c5fd998d2aa12b86d547a93746ed66"
GETTEXT_TARBALL="https://assets.mofoprod.net/gettext/gettext-0.20.1.tar.xz"

echo "-----> Downloading and installing gettext tools"

cd $BUILD_DIR

# Ensure the file was not cached
rm -f gettext.tar.xz

# Fetch our precompiled gettext package
curl -s -L -o gettext.tar.xz $GETTEXT_TARBALL

# Verify the contents of the package
if [ "$GETTEXT_SHA256" != "$(sha256sum gettext.tar.xz | cut -d ' ' -f 1)" ]; then
echo "Checksum doesn't match. gettext tools will not be installed."
exit 1
fi

# Extract the gettext tools
tar -xf gettext.tar.xz > /dev/null

# clean up
rm gettext.tar.xz

# Update PATH and LD_LIBRARY_PATH so that gettext binaries are available and can run.
PATH=$BUILD_DIR/gettext/bin:$PATH
LD_LIBRARY_PATH=$BUILD_DIR/gettext/lib:$LD_LIBRARY_PATH

# Copy the latest Portuguese (Brazil) file translated from Pontoon into the folder consumed by Django
cp $BUILD_DIR/locale/pt_BR/LC_MESSAGES/django.po $BUILD_DIR/locale/pt/LC_MESSAGES/django.po

# Compile localized strings
python $BUILD_DIR/manage.py compilemessages
@@ -15,3 +15,7 @@ COPY Pipfile Pipfile.lock ./

# Install app deps
RUN pipenv install -d

RUN apt-get update && apt-get install -y \
gettext \
--no-install-recommends && rm -rf /var/lib/apt/lists/*

This file was deleted.

@@ -0,0 +1,256 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-11-13 16:25+0000\n"
"PO-Revision-Date: 2019-10-21 22:59+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.2.4\n"

#: network-api/networkapi/templates/404.html:4
msgid "Page Not Found"
msgstr ""

#: network-api/networkapi/templates/fragments/language_switcher.html:6
msgid "Language"
msgstr ""

#: network-api/networkapi/templates/pages/base.html:9
#: network-api/networkapi/templates/partials/primary_nav.html:46
msgid "Mozilla Foundation"
msgstr ""

#: network-api/networkapi/templates/partials/404.html:7
msgid "Uh oh!"
msgstr ""

#: network-api/networkapi/templates/partials/404.html:9
msgid "Sorry, the page does not exist"
msgstr ""

#: network-api/networkapi/templates/partials/404.html:10
#, python-format
msgid "<a href=\"mailto:%(email)s\">Contact us</a> or ..."
msgstr ""

#: network-api/networkapi/templates/partials/404.html:11
msgid "Go to home page"
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:11
msgid "We all love the Web. Join Mozilla in defending it."
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:12
msgid "Let’s protect the world’s largest resource for future generations."
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:14
msgid "Donate now"
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:38
msgid "More about us"
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:41
msgid "Twitter"
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:42
msgid "Instagram"
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:43
msgid "GitHub"
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:50
#: network-api/networkapi/templates/partials/primary_nav.html:67
msgid "Donate"
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:51
msgid "Legal"
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:52
msgid "License"
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:53
msgid "Participation Guidelines"
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:54
msgid "Privacy"
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:55
msgid "Cookies"
msgstr ""

#: network-api/networkapi/templates/partials/footer.html:72
#, python-format
msgid "Mozilla is a global non-profit dedicated to putting you in control of your online experience and shaping the future of the web for the public good. Visit us at <a href=\"%(foundation_website_url)s\">%(foundation_website)s</a>"
msgstr ""

#: network-api/networkapi/templates/partials/primary_nav.html:17
msgid "Home"
msgstr ""

#: network-api/networkapi/templates/partials/primary_nav.html:19
#: network-api/networkapi/templates/partials/primary_nav.html:68
msgid "Newsletter"
msgstr ""

#: network-api/networkapi/templates/partials/primary_nav.html:88
msgid "No thanks"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/bannered_campaign_page.html:56
#: network-api/networkapi/wagtailpages/templates/wagtailpages/campaign_page.html:66
msgctxt "Sticky button in mobile view on campaign pages"
msgid "TAKE ACTION"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/blocks/recent_blog_entries.html:14
#: network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/featured_blogs.html:72
msgid "More from our blog"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/blog_page.html:27
#: network-api/networkapi/wagtailpages/templates/wagtailpages/blog_page.html:44
#, python-format
msgid "%(title)s by @mozilla"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/blog_page.html:34
#, python-format
msgid "By %(author)s"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/blog_card.html:37
#, python-format
msgid "By %(author)s on %(date)s"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/featured_blogs.html:8
msgid "Latest news"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/featured_blogs.html:31
#: network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/featured_blogs.html:58
#, python-format
msgid "by %(author)s"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/featured_blogs.html:33
#: network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/featured_blogs.html:60
#, python-format
msgid "on %(date)s"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/ih_cta.html:6
#, python-format
msgid "This is part of a broader movement for a healthy internet. <a %(see_more_link)s>See more</a>."
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/related_posts.html:8
msgid "Related content"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/homepage.html:36
msgid "Happening now"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/homepage.html:72
msgid "Trending projects"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/homepage.html:75
#: network-api/networkapi/wagtailpages/templates/wagtailpages/homepage.html:86
msgid "Add your project"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/homepage.html:85
msgid "More from our network"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/homepage.html:95
msgid "We want to give users the knowledge and the power to make informed decisions by themselves to prevent abusive practices."
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/homepage.html:96
msgid "Rishab Nithyanand, Mozilla Fellow"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/index_page.html:32
#, python-format
msgid "%(total_entries)s result"
msgid_plural "%(total_entries)s results"
msgstr[0] ""
msgstr[1] ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/index_page.html:37
msgctxt "Following “xx results” and followed by searched terms. Full string example: “12 results for Advocacy”"
msgid "for"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/index_page.html:48
msgid "clear filters"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/index_page.html:66
#, fuzzy
#| msgid "Load more stories"
msgid "Load more results"
msgstr "Mehr Storys laden"

#: network-api/networkapi/wagtailpages/templates/wagtailpages/pages/load-more-regrets.html:4
msgid "Load more stories"
msgstr "Mehr Storys laden"

#: network-api/networkapi/wagtailpages/templates/wagtailpages/pages/youtube_regrets_page.html:36
#: network-api/networkapi/wagtailpages/templates/wagtailpages/pages/youtube_regrets_page.html:37
msgid "Join Mozilla"
msgstr "Bei Mozilla mitmachen"

#: network-api/networkapi/wagtailpages/templates/wagtailpages/pages/youtube_regrets_page.html:43
msgid "Scroll"
msgstr "Scrollen"

#: network-api/networkapi/wagtailpages/templates/wagtailpages/pages/youtube_regrets_page.html:47
msgid "28 reasons why YouTube must change: startling stories of YouTube’s recommendations leading people down bizarre and dangerous paths"
msgstr "28 Gründe, warum YouTube sich ändern muss: erschreckende Berichte von YouTube-Empfehlungen und wie Leute dadurch auf Abwege geraten"

#: network-api/networkapi/wagtailpages/templates/wagtailpages/static/initiatives_page.html:30
#: network-api/networkapi/wagtailpages/utils.py:58
msgid "Overview"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/static/initiatives_page.html:32
msgid "Advocacy"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/static/initiatives_page.html:33
msgid "Internet Health Report"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/static/initiatives_page.html:34
msgid "Fellowships"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/static/initiatives_page.html:35
msgid "Awards"
msgstr ""

#: network-api/networkapi/wagtailpages/templates/wagtailpages/static/initiatives_page.html:36
msgid "MozFest"
msgstr ""

0 comments on commit 747cdfa

Please sign in to comment.
You can’t perform that action at this time.