Skip to content

Commit

Permalink
Enable translations for the SecureDrop Extension
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandyer committed Mar 27, 2023
1 parent d9d3899 commit f3d3f04
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@
- "{{ _securedrop_extension_info }}"
- "{{ tails_config_extension_directories }}"

- name: Add extension translations in Persistent Storage
synchronize:
src: "{{ tails_config_amnesia_persistent }}/securedrop/securedrop/translations/"
dest: "{{ tails_config_live_dotfiles }}/.local/share/gnome-shell/extensions/[email protected]/po/"

- name: Add extension translations in the running system
synchronize:
src: "{{ tails_config_amnesia_persistent }}/securedrop/securedrop/translations/"
dest: "/home/amnesia/.local/share/gnome-shell/extensions/[email protected]/po/"

- name: Enable the new GNOME Shell extension
become: no
command: gnome-extensions enable [email protected]
3 changes: 3 additions & 0 deletions securedrop/babel.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ silent=False
[jinja2: */*.html]
silent=False
extensions=jinja2.ext.autoescape,jinja2.ext.with_,jinja2.ext.do

[javascript: **.js.in]
extract_messages = $._, jQuery._
4 changes: 3 additions & 1 deletion securedrop/i18n_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
LOCALE_DIR = {
"securedrop": "securedrop/translations",
"desktop": "install_files/ansible-base/roles/tails-config/templates",
"extension": "install_files/ansible-base/roles/tails-config/templates",
}


Expand Down Expand Up @@ -236,7 +237,8 @@ def set_translate_messages_parser(self, subps: _SubParsersAction) -> None:
"translate-messages", help=("Update and compile " "source and template translations")
)
translations_dir = join(dirname(realpath(__file__)), "translations")
sources = ".,source_templates,journalist_templates"
extension_location = join(dirname(realpath(__file__)), "..", LOCALE_DIR["extension"])
sources = join(".,source_templates,journalist_templates,",extension_location)
self.set_translate_parser(parser, translations_dir, sources)
mapping = "babel.cfg"
parser.add_argument(
Expand Down

0 comments on commit f3d3f04

Please sign in to comment.