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

Grab po files for the docs. #252

Merged
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
2 changes: 1 addition & 1 deletion centralserver/central/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _

from fle_utils.django_utils import ExtendedModel
from fle_utils.django_utils.classes import ExtendedModel
from securesync.models import Zone


Expand Down
2 changes: 1 addition & 1 deletion centralserver/contact/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _

from fle_utils.django_utils import ExtendedModel
from fle_utils.django_utils.classes import ExtendedModel


# Different contact types
Expand Down
17 changes: 14 additions & 3 deletions centralserver/i18n/management/commands/update_pot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import os
import requests
import shutil
import subprocess
from optparse import make_option

from django.conf import settings
Expand All @@ -26,7 +27,6 @@

from ... import POT_DIRPATH, CROWDIN_API_URL
from fle_utils.general import ensure_dir
from kalite.i18n.management.commands import test_wrappings
from kalite import version

logging = settings.LOG
Expand All @@ -36,7 +36,7 @@
CROWDIN_API_URL = "https://api.crowdin.com/api/project"


class Command(test_wrappings.Command):
class Command(BaseCommand):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This thing has been fixed in 3 branches so far. Ha!

option_list = BaseCommand.option_list + (
make_option(
'--upload',
Expand Down Expand Up @@ -91,10 +91,21 @@ def inside_kalite():
ignore_patterns = ["*/python-packages/*", "*/kalite/static/*", "*/js/i18n/*.js",
"*/i18n/build/*", "*/media/language_packs/*"]
with inside_kalite():
# First make messages for the application
ensure_dir("locale")
call_command("makemessages", locale="en", ignore_patterns=ignore_patterns, no_obsolete=True, domain="django")
call_command("makemessages", locale="en", ignore_patterns=ignore_patterns, no_obsolete=True, domain="djangojs")
return glob.glob(os.path.join(''.join(settings.LOCALE_PATHS), "en", "LC_MESSAGES", "*.po"))
pofiles = glob.glob(os.path.join(''.join(settings.LOCALE_PATHS), "en", "LC_MESSAGES", "*.po"))
# Then for the docs
os.chdir(os.path.join("ka-lite-submodule", "sphinx-docs"))
subprocess.call(["make", "gettext"])
subprocess.call(["sphinx-intl", "update", "-p", "_build/locale", "-l", "en"])
docs_pofiles = set()
for root, _, _ in os.walk(os.getcwd()):
os.chdir(root)
docs_pofiles.update(glob.glob(os.path.join(os.getcwd(), "*.po")))
pofiles += list(docs_pofiles)
return pofiles


def insert_translator_comments(po_filepaths):
Expand Down
4 changes: 2 additions & 2 deletions centralserver/stats/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.conf import settings; logging = settings.LOG
from django.db import models

from fle_utils.django_utils import ExtendedModel
from fle_utils.django_utils.classes import ExtendedModel
from securesync.models import ID_MAX_LENGTH, IP_MAX_LENGTH


Expand Down Expand Up @@ -48,4 +48,4 @@ def record_ping(cls, id, ip):

except Exception as e:
# Never block functionality
logging.error("Error recording unregistered device ping: %s" % e)
logging.error("Error recording unregistered device ping: %s" % e)
5 changes: 0 additions & 5 deletions centralserver/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@

from django.conf import settings

from fle_utils.importing import import_all_child_modules


import_all_child_modules()

if settings.USE_DEBUG_TOOLBAR:
assert settings.CACHE_TIME == 0, "Debug toolbar must be set in conjunction with CACHE_TIME=0"