Skip to content

Instantly share code, notes, and snippets.

@Kwpolska
Created January 23, 2014 16:29
Show Gist options
  • Save Kwpolska/8581727 to your computer and use it in GitHub Desktop.
Save Kwpolska/8581727 to your computer and use it in GitHub Desktop.
diff --git a/CHANGES.txt b/CHANGES.txt
index df8aab1..59318e3 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -32,6 +32,8 @@ Features
* Add rel=alternate <link> elements to translations of the current page (Issues #988, #989)
* Added a INDEXES_PAGES_MAIN setting to show the page number on the index page
if desired (True) (Issues #210, #987)
+* Added a TRANSLATIONS_PATTERN setting to specify the format for
+ language-dependent filenames (Issue #990)
Bugfixes
--------
diff --git a/docs/manual.txt b/docs/manual.txt
index 37e9190..e58eec7 100644
--- a/docs/manual.txt
+++ b/docs/manual.txt
@@ -559,7 +559,7 @@ to your configuration::
2012/09/15 19:52:05
If you are writing a multilingual site, you can also create a per-language
-post file (for example: ``how-to-make-money.txt.es`` with the default TRANSLATIONS_PATTERN, see below).
+post file (for example: ``how-to-make-money.txt.es`` with the default TRANSLATIONS_PATTERN, see below).
This one can replace metadata of the default language, for example:
* The translated title for the post or page
@@ -568,7 +568,7 @@ This one can replace metadata of the default language, for example:
The pattern used for finding translations is controlled by the
TRANSLATIONS_PATTERN variable in your configuration file.
-The default as in the example above is to append the language code to the
+The default as in the example above is to append the language code to the
filename path to identify a translation of a file, so the German translation
of ``some_file.rst`` should be named ``some_file.rst.de``. This is because
the TRANSLATIONS_PATTERN variable is by default set to::
@@ -578,9 +578,9 @@ the TRANSLATIONS_PATTERN variable is by default set to::
However, if you don't want your Polish input files to be considered
Perl code (e.g. ``some_file.rst.pl``), you could use this pattern::
- TRANSLATIONS_PATTERN = "{path}_{lang}.{ext}"
+ TRANSLATIONS_PATTERN = "{path}.{lang}.{ext}"
-It is likely that this pattern will become the default in version 7.
+Note that this pattern will become the default in v7.0.0.
.. note:: Considered languages
@@ -633,9 +633,10 @@ and ``PAGES`` configuration options::
# (whatever/thing.txt).
#
# That fragment could have an associated metadata file (whatever/thing.meta),
- # and optionally translated files (example for spanish, with code "es"):
+ # and optionally translated files (example for Spanish, with code "es"):
# whatever/thing.txt.es and whatever/thing.meta.es
- # with the default TRANSLATIONS_PATTERN (see above)
+ #
+ # This assumes you use the default TRANSLATIONS_PATTERN.
#
# From those files, a set of HTML fragment files will be generated:
# cache/whatever/thing.html (and maybe cache/whatever/thing.html.es)
diff --git a/nikola/conf.py.in b/nikola/conf.py.in
index 793ec6c..02562e5 100644
--- a/nikola/conf.py.in
+++ b/nikola/conf.py.in
@@ -51,7 +51,7 @@ BLOG_DESCRIPTION = "${BLOG_DESCRIPTION}"
#
# If you want to use Nikola with a non-supported language you have to provide
# a module containing the necessary translations
-# (p.e. look at the modules at: ./nikola/data/themes/default/messages/fr.py).
+# (cf. the modules at nikola/data/themes/base/messages/fr.py).
# If a specific post is not translated to a language, then the version
# in the default language will be shown instead.
@@ -60,25 +60,26 @@ DEFAULT_LANG = "${DEFAULT_LANG}"
# What other languages do you have?
# The format is {"translationcode" : "path/to/translation" }
-# the path will be used as a prefix for the generated pages location
+# the path will be used as a prefix for the generated pabaseation
TRANSLATIONS = {
DEFAULT_LANG: "",
# Example for another language:
# "es": "./es",
}
-# What will translated input pages be named like?
-# if you have a page something.rst then something.rst.pl
-# will be considered its Polish translation
-# in the above example path == "something", lang == "pl",
-# ext == "rst"
-# this pattern is also used for metadata,
-# something.meta -> something.meta.pl
+# What will translated input files be named like?
+
+# If you have a page something.rst, then something.rst.pl will be considered
+# its Polish translation.
+# (in the above example: path == "something", lang == "pl", ext == "rst")
+# this pattern is also used for metadata:
+# something.meta -> something.meta.pl
+
TRANSLATIONS_PATTERN = "{path}.{ext}.{lang}"
-# If you don't want your Polish files to be considered
-# Perl code, you could use this pattern
-# TRANSLATIONS_PATTERN = "{path}_{lang}.{ext}"
-# this new pattern will most likely become default in v7
+
+# If you don't want your Polish files to be considered Perl code, use this:
+# TRANSLATIONS_PATTERN = "{path}.{lang}.{ext}"
+# Note that this pattern will become the default in v7.0.0.
# Links for the sidebar / navigation bar.
# You should provide a key-value pair for each used language.
@@ -114,6 +115,8 @@ NAVIGATION_LINKS = {
# and optionally translated files (example for spanish, with code "es"):
# whatever/thing.txt.es and whatever/thing.meta.es
#
+# This assumes you use the default TRANSLATIONS_PATTERN.
+#
# From those files, a set of HTML fragment files will be generated:
# cache/whatever/thing.html (and maybe cache/whatever/thing.html.es)
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment