Граф коммитов

231 Коммитов

Автор SHA1 Сообщение Дата
Paul McLanahan a593d85f4d Add brand term detection and replacement to fluent recipe migration script
Fix #8612
2020-06-26 17:20:36 +01:00
Paul McLanahan 4ff16fb4d5 Add a fallback to the en version of a brand term for Fluent strings
In Fluent each term you use in a string has to be availalbe in that
locale bundle. This change adds the english brands.ftl to every
non-en bundle so that it will fall back to en brand names if the
locale doesn't have a translation for that string.
2020-06-26 16:34:15 +01:00
Alex Gibson 374fdb4df7
Fix trans block formatting in Fluent template migration (Fixes #8959) (#8960) 2020-05-29 09:26:33 -07:00
Paul McLanahan 1dcea384e3
Add automation to submit a PR for Fluent file changes (#8786) 2020-04-23 09:50:21 +01:00
Paul McLanahan fdfed79a52 Fluent active locales should be all of them in DEV mode
This will ensure that all functions that use `fluent.get_active_locales` treat
all locales as active when `DEV=True`.
2020-04-22 15:14:23 +01:00
Paul McLanahan e58d7cc722 Fix potential ftl_files memory leak
If a list of ftl_files that was defined in the view was passed
to render() it would have updated the original list in place with
the list of default files, and this would have incresed the size of the
list every call to render() for that function.
2020-04-16 15:25:08 +01:00
Paul McLanahan acc232e038
Update Fluent python view utils with better dev UX (#8751)
* Update Fluent python view utils with better dev UX

This updates the `ftl`, `ftl_lazy`, and `has_messages` functions that
are for use in Python code to not require fluent files to be defined
if using the default files, to allow passing a single fluent file
as a string instead of a list, and to require fluent files to be
passed in via the `ftl_files` keyword argument.

* Update docs with new usage pattern for Python ftl function
2020-04-06 18:13:02 +01:00
Paul McLanahan 913a5ce003 Add ability to commit and push changes to Fluent repo
Add a --push argument to the `process_ftl` management
command and add a gitlab automation to run this command.

Fix #7705
2020-03-26 15:05:40 +00:00
Paul McLanahan bb386bbab0 Fix Fluent error on supported nonlocale pages
This change results in passing every page render through the l10n
system, even ones in the SUPPORTED_NONLOCALE list.

Fix #8680
2020-03-20 18:07:50 +00:00
Alex Gibson c516982045
Migrate navigation.lang to Fluent (Fixes #8653) (#8665) 2020-03-20 09:47:46 +00:00
Axel Hecht 23c7279518 Make migration off of .lang more Fluent.
Pick up fixes from `fluent.migrate`, and pass the right argument
when converting the en FTL file.
Also, update docs to suggest running `moz-l10n-lint`.
Some minor fixes to the fluent recipes, and really small improvement
on the `fluent activation` command.
2020-02-27 13:38:12 +00:00
Paul McLanahan afbc6956c7 Include the TOML configs when updating the Fluent repo
Re #7705
2020-02-24 09:27:48 +00:00
Paul McLanahan dd762da2d9 Sort active locales in fluent metadata automation 2020-02-14 17:37:13 +00:00
Paul McLanahan b6f51e82be
Add process_ftl command for updating bedrock ftl git repo (#8523)
This command does multiple things:

1. Update both the mozmeao/www-l10n repo and the mozilla-l10n/www-l10n one.
2. Copy all of the .ftl files from the mozilla-l10n repo to mozmeao
3. Check if they are valid .ftl files, and if not do not copy them
4. Check all of the successfully copied ones for activation rules
5. Write any newly activated locales to the metadata files
2020-02-14 16:59:23 +00:00
Axel Hecht 260ecc683d Start a management command for activation 2019-12-20 16:17:23 -05:00
Axel Hecht 4a4b2957d1 Move get_lang_files to _fluent in preparation for activation command 2019-12-20 16:17:23 -05:00
Axel Hecht a3daaf3a71 Update fluent.migrate API, add requirements file 2019-12-20 16:17:23 -05:00
Axel Hecht 638c08ee7a fix lint 2019-12-20 16:17:23 -05:00
Axel Hecht ca9c949648 Add args and trans blocks to template processor 2019-12-20 16:17:23 -05:00
Axel Hecht 0eb707d7d2 add support for {% trans %} blocks 2019-12-20 16:17:23 -05:00
Axel Hecht 55936805d5 Updated fluent.migrate API 2019-12-20 16:17:23 -05:00
Axel Hecht 48b1799b1f address review comments 2019-12-20 16:17:23 -05:00
Axel Hecht 0a9689bca6 Fixups 2019-12-20 16:17:23 -05:00
Axel Hecht 77f5776d68 Add subcommand to create migrated FTL files 2019-12-20 16:17:23 -05:00
Axel Hecht 39f337bb5f Migrate template from recipe 2019-12-20 16:17:23 -05:00
Axel Hecht 4d8559a47f Create Fluent migration recipes from an existing template. 2019-12-20 16:17:23 -05:00
Paul McLanahan fc756200d8 Add more ftl file helpers to L10nTemplateView 2019-12-06 10:23:15 +00:00
Paul McLanahan 87e708ff7d Separate LANG and FTL file caches
A long cache timeout is desireable for LANG cache during dev, but
a short one is best for Fluent. This allows us to have both.

Fix #8056
2019-11-14 14:41:38 +00:00
Paul McLanahan a8114a786e Add Fluent L10n system and port the Mission page to use it
* Fix dict cache default timeout
* Add fallback strings and checking for translations in template
* Add ftl alias and ftl_lazy for use in py files
* Move git repos and add fluent to l10n_update
* Add percent_translated and required_messages to the l10n object
* Add management commands for converting en-US .lang file and templates
* Add command to convert en-US .lang file to .ftl file
* Using data from above command add a command that will convert a
template to use the .ftl strings
* Update the l10n_update command to update both external l10n repos
* Convert the /mission/ page to Fluent
* Add command to convert .lang translations to .ftl
* Copy en .ftl file when porting translations
  * Removes the original string hash comments as well.
* Add Fluent docs.
* Add indentation and key sorting to metadata JSON output
* Add FTL file linting command
* Update mission template for FTL and remove FTL specific template
* Set l10n cache to 10s when DEBUG=True
* Fix and add tests for get_l10n_path
* Fix some style mistakes in docs and code
* Support multiline group comments for required strings

fix #7725, fix #7822, and fix #7726
2019-10-28 16:46:11 +00:00
Stephanie Hobson 98bf654f24 Activate mozilla footer and firefox nav and footer for all (#7913) (#7936) 2019-10-16 15:45:58 -07:00
Paul McLanahan ed7b0e5a73 Add generic Geo redirector view class
* Support full URLs as well as URL names
* Add docs and never cache headers
* Clean up the view docs a bit

Fix #6084
2019-09-02 16:18:51 +01:00
Paul McLanahan a5c85b5a4f Remove pathlib2 (#7540)
pathlib2 is a backport of the Python 3.4+ standard library
pathlib. This PR just removes the now superfluous library
and switches all code to use the stdlib version. It also cleans
up some flake8 errors in some of the files updated.
2019-08-07 10:05:47 -05:00
Chris Beaven bf67e8bf34 Django 2.2 (#7196)
* Complete removal of nose test artifacts

* Update base requirements to Django 2.2 and python 3 compatibile packages
2019-07-03 02:24:42 -05:00
Paul McLanahan 05c453c975 Upgrade Puente and fix args for l10n management commands (#7182)
Django 1.11 switched to argparse for arguments and added a method
for adding them. This was missed for the l10n commands during the
Django upgrade. Also the Puente library needed to be updated to a
supported version.

Fix #7181
2019-05-13 11:39:26 -05:00
Chris Beaven d5d793964f Remove workaround to an exception that was fixed back in Django 1.7 2019-05-02 10:32:03 -04:00
Chris Beaven a102d32eb9 Fix template tests that failed due to exception change in new django version 2019-05-02 10:32:03 -04:00
Chris Beaven a12d29adbc More robust locale tests 2019-05-02 10:32:03 -04:00
Chris Beaven a1bfb202ba TestCase.urls is was deprecated in Django 1.8 2019-05-02 10:32:03 -04:00
Chris Beaven 44ffd4dbd0 Fix some redirection tests to not assume full uri 2019-05-02 10:32:03 -04:00
Chris Beaven aae1cf1d3d Complete removal of nose test artifacts 2019-05-02 10:32:03 -04:00
Paul McLanahan d2de536367 Fix long template l10n comments being truncated
Fix #6990
2019-03-27 17:18:51 +00:00
Alex Gibson d44f5c3164 Localize Protocol navigation (Fixes #6498) (#6642)
* Localize Protocol navigation (Fixes #6498)
* Add navigation.lang to DOTLANG_FILES
* Update functional tests for new navigation
* Remove some old Tabzilla cruft
2019-01-31 17:09:29 -08:00
Paul McLanahan 3bf8e8cca1 Fix #5851: Support overriding or ammending list of locales (#6035)
This modifies how several parts of translation in bedrock work:

1. You can now provide a list of locales in `active_locales` in
   the template context that will be the list of available
   translations for the page.
2. You can now provide a list of locales in `add_active_locales`
   to add extra available translations for the page.
3. The `page()` and `LangFilesMixin` helpers are updated to support
   these new context items.
4. You can now create and use `en-US` locale-specific-templates.
2018-10-04 10:50:42 -05:00
Paul McLanahan 47e86b6541 Fix #6000: Map legal-docs locales to bedrock prod locales (#6001)
* Fix #6000: Map legal-docs locales to bedrock prod locales

Also filter out legal-docs translations that are not production
bedrock locales.

* Extract translations dict function for later use as well
2018-08-13 16:25:56 -05:00
Paul McLanahan 1370d2e106 Move tests.py to tests/test_base.py so pytest will find and run them
Seems we've been ignoring these tests for quite a while.
Also move tests in l10n_utils/tests/__init__.py so pytest can find them.
2018-04-16 15:02:07 -04:00
Paul McLanahan 16a25cdd30 Fix bug 836587: Add "Source code for this page" link to footer
It will be a link to the current template source on github.

Original inspiration for this commit from:

https://github.com/l-hedgehog/bedrock/commit/36f011c0
2017-10-25 13:53:44 -04:00
Paul McLanahan 6185290ca8 Fix bug 1380229: lang file ok tag avoids untranslated skip
This allows untranslated strings with the {ok} tag
to override the same translated string from another
lang file in the set.
2017-07-12 09:33:25 -04:00
Paul McLanahan fc53c771af Convert l10n_update command to use new git util 2016-10-12 10:04:27 -04:00
Paul McLanahan 5fb4aa3c04 Switch to pathlib2 2016-10-12 10:04:27 -04:00
Paul McLanahan dcf285d4aa Remove and clone locale dir if not a repo in l10n_update 2016-10-03 12:59:32 -04:00
Paul McLanahan d2fa322020 Fix bug 1156344: Upgrade to Django 1.8
* Switch to django-jinja from jingo
* Switch to django-jinja-markdown
2016-08-15 10:52:49 -04:00
Paul McLanahan f7fe37c30f Bug 1287982: Add unit-tests for translation utilities 2016-07-19 22:47:02 -04:00
Paul McLanahan 5fbaf5624e Fix languages not recognized by Django
Using Django's i18n infra for activation of translation
means that it looks for .mo files to decide whether to
activate it. This means that only those languages that
ship with Django will activate. Since we have our own
i18n system anyway we can copy their mechnics with a
much more simple system.
2016-07-19 20:59:44 -04:00
Paul McLanahan 15410b54f9 Remove waffle and convert to env vars 2016-07-19 14:46:18 -04:00
Paul McLanahan 26a9bd16a3 Upgrade Jingo and Jinja2 2016-07-19 14:46:18 -04:00
Paul McLanahan a3c1411e10 Bug 1156344: Switch from Tower to Puente for i18n
First step on the way to the Django 1.8.x upgrade.
2016-07-19 09:36:36 -04:00
Paul McLanahan 0cbc377e78 Add management command for cloning/updating l10n files 2016-03-28 14:52:17 -04:00
Jon Petto 62f0107fa4 [fix bug 1222137] Enable bedrock locale-based templates. 2016-02-19 15:15:04 -06:00
Paul McLanahan a749d81cc2 Do not require MANAGERS setting for tests to pass 2015-11-19 12:09:14 -05:00
Paul McLanahan 401af18ab1 Update tests to pass without l10n files. 2015-10-05 21:43:35 -04:00
Pascal Chevrel 04feec54e6 Bug 1197244 - Newsletters Control Center: use a separate .lang file for all the newsletter stuff
* newsletter.lang is no longer loaded as a default langfile for all templates (because only 8 locales do the newsletters and default files are assigned to all locales)
* all newsletter templates and newsletter python files except the hacks blog get their strings extracted to mozorg/newsletters.lang
* newsletter/views.py was loading strings from the contribute page, now they are also loaded from mozorg/newsletters.lang
* mozorg/forms.py now also loads strings from mozorg/newsletter.lang
* One string was corrected in a template (2 spaces instead of 1)
* tests and documentation updated

The mozorg/newsletters.lang file already has all the string copied from newsletter.lang and the file is on production on svn for the 8 locales that translate newsletters.

Strings in newsletter.lang that were used outside of newsletters were moved to main.lang

We will remove the old newsletter.lang from svn only once bedrock will run the new code and will no longer include newsletter.lang by default for all pages.
2015-09-28 15:43:08 +02:00
Paul McLanahan 52c9b40781 Bug 1200354: Add decorator support to redirects helper.
* Remove pytest-xdist from standard run.  It's slower than normal if testing the local server.
* Add recommendation to use it if testing a remote instance to README.
* Remove pytest.ini in favor of using setup.cfg.
* Fix tests after redirects modification.
* Add py to redirects requirements.
2015-09-16 16:12:14 -07:00
Paul McLanahan 22a2e276e5 Update all urls.py files to avoid deprecated function.
Using `patterns` is deprecated, and just using an iterable is no
preferred.
2015-09-16 15:52:24 -07:00
Josh Mize 46f1b895dc 12-factorify settings: fix bug 1182394 2015-07-20 02:46:44 -05:00
Josh Mize bb17f1004d Upgrade tower, install_gettext_callables 2015-07-10 01:55:16 -05:00
Paul McLanahan 737d214862 Add simple dict cache for more speed.
Include cache backend tests from Django.
2015-06-17 23:15:37 -04:00
Malena Andrade cd943d6b8b Bug 1159230 - Remove old mozilla.org home page template 2015-06-05 14:55:50 -04:00
Paul McLanahan 097e41cd0b Bug 1157265: Upgrade Django to 1.7.8.
* Upgrade south migrations to new Django native ones.
* Update deployment to use `migrate` in place of `syncdb`.
* Upgrade waffle and django-extensions for 1.7 compat.
2015-05-18 13:11:44 -04:00
Kohei Yoshino 5f5106391b Fix Bug 1164781 - Spanish locales are redirected to /en-US instead of /es when page is not localized 2015-05-15 00:42:43 -04:00
Paul McLanahan 11f0f9a197 Fix bug 1155810: Remove funfactory.
Well... actually it mostly just moves most of funfactory
from an external lib to bedrock.base. But at least this way
we can remove the bits we don't need and be ready to make
the changes we need to upgrade to Django 1.8.

I can't come close to writing as perfect a commit message
for this as @willkg did for fjord, so I'll just leave this here.

https://github.com/mozilla/fjord/commit/9d7c97b
2015-04-29 16:58:25 -04:00
Paul McLanahan 64c4f17758 Fix bug 1130285: Treat hsb/dsb locales as de for number formatting. 2015-02-06 11:04:31 -05:00
Kohei Yoshino 095784321b Fix Bug 1097785 - Legal-docs-based pages should not rely on active tags in .lang files 2015-01-27 14:47:57 -05:00
Paul McLanahan bc64aa0eda Fix bug 1102955: Use old contribute form for most locales on new page.
Allow us to enable the new contribute pages for all locales
without having to wait for new ET-based responders to be setup.
2014-11-26 11:35:57 -05:00
Paul McLanahan 76b2db3a1c Fix bug 1100539: Default language has all the tags. 2014-11-17 16:17:00 -05:00
Paul McLanahan 6bd7991136 Fix bug 920113, 949163: tags should be from all lang files.
Tags (including "active") should be from all .lang files associated with
a template. So l10n_has_tag() as well as the active state of a page
should include information from all included .lang files from
add_lang_file and set_lang_files calls.

This also moves the check for DEV==True to the helpers, so checking
settings.DEV in templates is no longer necessary.
2014-11-14 16:36:15 -05:00
Paul McLanahan 74eb768eec Fix test failures caused by recent changes. 2014-10-15 12:05:00 -04:00
Paul McLanahan 884158cf72 Show translations from all lang files for the template. 2014-10-15 11:31:30 -04:00
Paul McLanahan da5ea79da4 Bug 1054437: Add newsletter form to new contribute pages. 2014-10-14 12:33:24 -07:00
Paul McLanahan b03bffb5d7 Bug 1078297: Fix localized number formatting helper for jinja templates 2014-10-10 11:49:02 -04:00
Paul McLanahan 0512e72581 Bug 1078297: Change l10n_format_* helpers to use lang from context. 2014-10-10 10:49:56 -04:00
pascalc 655649f544 Bug 1078297: Need localized number formatting helper for jinja templates 2014-10-10 10:48:10 -04:00
pascalc 0607768e18 Bug 1078655: update regex in dotlang parser to allow dashes 2014-10-06 22:16:46 +02:00
Paul McLanahan bb48ae80d5 Fix bug 1061228: Fix locale redirect exemption in page() helper. 2014-09-11 13:24:02 -04:00
Paul McLanahan a730fe41da Bug 1026184: Port /security to bedrock.
Add an update_security_advisories command to pull
in and parse the advisroies from the git repository.
2014-08-21 13:26:45 -04:00
Paul McLanahan 89b2ea658b Fix bug 1004598: Enable framing of /firefox/new/ 2014-07-02 15:11:47 -04:00
Kohei Yoshino b0b6f32175 Fix Bug 975020 - Translation Bar and non-locale redirects don't work as expected in some cases; use the user's accept language list to fix it 2014-05-28 17:17:26 -04:00
Kohei Yoshino ad67bd4371 Implement The Web We Want promo on Tabzilla, Bug 993129 2014-04-28 14:46:47 -07:00
Josh Mize c7fc48ff64 Merge pull request #1356 from pmclanahan/use-locmem-cache-for-l10n
Add locmem cache for l10n use.
2014-03-18 15:41:19 -05:00
Paul McLanahan 95a490bc2a Fix bug 982755: Fix POT file conversion when string ends with quote. 2014-03-12 16:35:51 -04:00
Paul McLanahan 7fb0752d81 Add locmem cache for l10n use.
Add statsd instrumentation to locmem cache backend.
2014-03-10 11:30:03 -04:00
Josh Mize 12e04ee15e Update RNA to 98c95295 2014-02-27 19:50:06 +00:00
Josh Mize c8c7e1901e Upgrade south to 0.8.4
Use bug_list and bug_search_url fields in template

Add jingo_markdown

Upgrade RNA (4ae910da)

Add firefox.system_requirements view using RNA

Use latest RNA as submodule instead of pip install

Adjust views, settings, templates to use latest RNA

Restore lib/l10n_utils/helpers.py and tests from rebase mistake

Move django-extensions to submodule

Cleanup old rna egg-info

Move django-rest-framework to submodule

Move requests to submodule

Move Python-Markdown to submodule

Move jingo-markdown to submodule

Move six to submodule

Test RNA views + flake8 fixes

Fix flake8

Try to fix Jenkins test breakage

Clean up templates

Cleanup template some more

Reword test docstring and add comments

Update requiremnts/prod.txt to match submodules

Use settings.LANGUAGE_CODE for default locale

Try to make Jenkins happy
2014-02-26 22:28:16 +00:00
Paul McLanahan afa188a424 Bug 942273: Add template helper for langfile tags. 2013-12-05 17:18:37 -05:00
Paul McLanahan 9cc46b45a3 Bug 920067: Enable the database.
* Add sqlite config to base settings.
* Update tests to use Django's database aware TestCase.
* Install south.
* Install django-waffle.
* Update jenkins to use the database for CI.

Django admin will be enabled in a separate PR.
2013-11-14 15:11:02 -05:00
Paul McLanahan af82ffd059 Add lib to flake8 run and fix pep8 issues.
Remove schematic files.
2013-10-31 11:10:38 -04:00
Paul McLanahan 933609e6a7 Bug 920113: Use the specified lang file for activation.
If a template uses the "set_lang_files" template tag
we should check the first lang file in that list if
the lang file for the specific template name isn't
active.
2013-10-24 11:15:04 -04:00
Jon Petto f642b8258e Update /firefox/whatsnew with FxOS messaging. Bug 890114.
- Specified locales get FxOS messaging.

- Old messaging retained for legacy/other use.

- Update l10n_utils render function to handle list of
  templates.
2013-10-21 12:58:35 -05:00
Craig Cook bf1028ba70 Bug 925931 - Restore secondary home page templates
Continuing the 80/10/10 split while we work on some further design options before going 100% with the new home page.
2013-10-14 10:59:39 -07:00
Paul McLanahan fbc1b89709 Fix bug 925931: Enable new home page for all locales. 2013-10-11 18:24:53 -04:00
Craig Cook c1773d71ec Bug 916151 - home page redesign
With contributions from @pmclanahan, @alexgibson, and @pascalchevrel
2013-09-30 13:11:31 -07:00