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

[i18n_subsites] Allow merging the base settings with the translations settings. #1350

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

adiroiban
Copy link

@adiroiban adiroiban commented Sep 26, 2021

To help organize the translations any text from pelicanconf.py that is presented on the site is put in a common dictionary

The idea is that if you add a new value in the default site and that site is not translated, it will be present in the translated site using the default language....similar to gettext.


Instead of using a simple copy with overwriting of root dict keys I went with a simple dict merge code.

I have simplified the tests.

to run the tests

virtualenv venv
. venv/bin/activate
pip install pelican
python -m unittest i18n_subsites/test_i18n_subsites.py

An example

L10N = {
    'author': 'Pro:Atria Team',
    'company': 'Pro:Atria Ltd',
    'company_number': '4213930',
    'product': 'SFTPPlus',
    'email': {
        'contact': '[email protected]',
        'sales': '[email protected]',
        'support': '[email protected]',
        },
    'menu': [
        # Text, URL, category.
        ('Product', '/product/', 'product'),
        ('Support', '/support/', 'support'),
        ('Contact', '/about/contact.html', 'contact'),
        ],
    }

I18N_SUBSITES = { 'de': 'L10N': {
    'company': 'Pro:Atria Ag',
    # The other emails are kept as in the main site.
    'email': {'sale': '[email protected]'},
    'menu': [
        # Text, URL, category.
        ('Produkt', '/de/product/', 'product'),
        ('Support', '/de/support/', 'support'),
        ('Kontakt', '/de/about/contact.html', 'contact'),
        ],
}}

@adiroiban
Copy link
Author

I also have a patch to translate the values from pelicanconf.py using gettext.

But I think that this patch is still valid for people who don't want to use gettext

@georgkrause
Copy link

@adiroiban Mind filing the same against my fork at https://github.com/georgkrause/i18n_subsites ?

rschiang added a commit to rschiang/pelican-plugins that referenced this pull request Aug 9, 2022
[i18n_subsites] Allow merging the base settings with the translations settings.
rschiang added a commit to rschiang/pelican-i18n-subsites that referenced this pull request Aug 9, 2022
…ict-merge

[i18n_subsites] Allow merging the base settings with the translations settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants