| Version 20 (modified by JensDiemer, 5 months ago) |
|---|
In v0.9 we would like to add a support for multi language cms page contents
Here we are collecting some facts about this here.
First of all
- All i18n stuff should be easy to use
- it should not be too much work it to implement
- too much to configure works against "easy to use"
- we should try to give the user a straight workflow
- Easy to update for a existing installation
the facts
- default language:
- the user must set a default language. How? (see below)
- A page must at least exist in the default language
- A new page is provided first in the default language, after this a user can create the page content in a other language
- split "Page" table into text content and meta data: All continuous data remain in the PAGE table. All language specific data went into a separated model.
- The shortcuts are always in the default language.
- menu/sitemap:
- items change the language
- pages which don't exists in requested language, should show up in default language
open facts
- How can the user specify the "other language" of a new page? Should we get him a list of all possible language? The django global_settings.py holds a list of language.
- How can the user specify the default language? Should we use settings.LANGUAGE_CODE for this?
- language separation for templates too? (make sense if the user has some text in the template)
- Use the language specific PageContent class for the page archive, too?
- How to update? Ideas:
- Only rename the old model class and add the new models. So we can access both models the old and new and migrate the data.
- shortcuts/permalinks:
- Build shortcuts/permalinks only in the default language: The URL line and every permalink is always the same
- use the requested/existing language: URL line/permalinks exists in different language.
- How to cache?
- We have two i18n things:
- i18n page content
- i18n gettext strings in templates/plugin output (django has over 40 translations)
- solutions:
- Bad idea, blow up the cache with all variants: cache_key = url + cms_page_lang + client_lang
- Other idea: Use the cms page language for gettext translation: connect cms_page_lang with client_lang
- We have two i18n things:
How to build urls/permalink?
current implementation:
- urls:
- The current urls build from the page shortcut: domain.tld/shortcut1/shortcut2/
- There exist no filename in a url
- Only the last existing shortcut used to get the current page. All other parts of the url would be ignored (See also forum thread)
- permalink:
- Permalinks looks like this: http://www.pylucid.org/_goto/125/internal-links/
- Only the id in the url use to get the current page. The _goto view makes a redirect to the right page url.
The new implementation must recognize the existing language of a page.
- variant 1 - file based on page shortcut
- urls:
- There exist only one language independently shortcut for a page.
- permalink:
- Only the id in the url use to get the current page.
- From the "filename" only the lang code are recognized all other parts ignored
- pros
- relative short urls
- default language with, e.g:
- domain.tld/shortcut1.html or domain.tld/shortcut1/ ?
- cons
- complicated structure
- urls e.g.:
- domain.tld/shortcut1.de.html
- domain.tld/shortcut1.en.html
- domain.tld/shortcut1/shortcut2.de.html
- domain.tld/shortcut1/shortcut2.en.html
- permalink e.g.:
- domain.tld/_goto/125/shortcut1.de.html
- domain.tld/_goto/125/shortcut2.en.html
- urls:
- variant 2 - file based with a 'index' file
- pros
- default language with:
- domain.tld/shortcut1/index.html or domain.tld/shortcut1/
- default language with:
- cons
- complicated structure
- long
- 404 on wrong url: domain.tld/shortcut1/ ?
- urls e.g.:
- domain.tld/shortcut1/index.de.html
- domain.tld/shortcut1/index.en.html
- domain.tld/shortcut1/shortcut2/index.de.html
- domain.tld/shortcut1/shortcut2/index.en.html
- permalink e.g.:
- domain.tld/_goto/125/shortcut1/index.de.html
- domain.tld/_goto/125/shortcut2/index.en.html
- pros
- variant 3 - language as the first directory
- pros:
- short
- cons:
- how to get the default lang?
- domain.tld/shortcut1/ ? (difficult to keep apart)
- how to get the default lang?
- urls e.g.:
- domain.tld/de/shortcut1/
- domain.tld/en/shortcut1/
- domain.tld/de/shortcut1/shortcut2/
- domain.tld/en/shortcut1/shortcut2/
- permalink e.g.:
- domain.tld/_goto/125/de/shortcut1/
- domain.tld/_goto/125/en/shortcut2/
- pros:
variant 4b is favoured
- variant 4 - language as the last directory
- pros:
- short
- easy to get the default language (or we can built a page with a list of all available language):
- domain.tld/shortcut1/
- domain.tld/_goto/125/shortcut1/
- cons
- ?
- urls e.g.:
- domain.tld/shortcut1/de/
- domain.tld/shortcut1/en/
- domain.tld/shortcut1/shortcut2/de/
- domain.tld/shortcut1/shortcut2/en/
- variant 4b - lang.code as a prefix:
- domain.tld/de/shortcut1/
- domain.tld/en/shortcut1/
- domain.tld/de/shortcut1/shortcut2/
- domain.tld/en/shortcut1/shortcut2/
- permalink e.g.:
- domain.tld/_goto/125/shortcut1/de/
- domain.tld/_goto/125/shortcut2/en/
- pros:
- variant 5 - unique shortcuts
- The page shortcuts are language dependent.
- pros
- short
- permalink system doesn't change
- cons
- problem with not unique page names (e.g. anglicist pages like "links")
- solution 1: Append language code on double shourtcuts, e.g.:
- domain.tld/links-de/
- domain.tld/links-en/
- solution 2: urls always start with the language code as a "prefix", e.g.:
- domain.tld/de/links/
- domain.tld/en/links/
- solution 1: Append language code on double shourtcuts, e.g.:
- We can't make a "index" page, with a list of all available language.
- problem with not unique page names (e.g. anglicist pages like "links")
- urls e.g.:
- domain.tld/contact/ - (en)
- domain.tld/kontakt/ - (de)
- permalink e.g.:
- domain.tld/_goto/123/contact/
- domain.tld/_goto/456/kontakt/
future plans
- If Django supports Routing according also to hostname it's possible to use sub domains with language code, e.g:
- /en/contact/ -> en.domain.tld/contact/
- /de/contact/ -> de.domain.tld/contact/
links
- the new model file in the SVN trunk: new_v09_models.py
- http://pylucid.org/_goto/125/internal-links/
- django-multilingual:
- transdb:
- django
- i18n in urls:
(Important: If you want to edit wiki pages, please login as guest/guest.)