summaryrefslogtreecommitdiffstats
path: root/nikola/plugins/command/import_wordpress.py
diff options
context:
space:
mode:
Diffstat (limited to 'nikola/plugins/command/import_wordpress.py')
-rw-r--r--nikola/plugins/command/import_wordpress.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/nikola/plugins/command/import_wordpress.py b/nikola/plugins/command/import_wordpress.py
index b567c77..8ddc8c7 100644
--- a/nikola/plugins/command/import_wordpress.py
+++ b/nikola/plugins/command/import_wordpress.py
@@ -51,7 +51,7 @@ from nikola import utils
from nikola.utils import req_missing
from nikola.plugins.basic_import import ImportMixin, links
from nikola.nikola import DEFAULT_TRANSLATIONS_PATTERN
-from nikola.plugins.command.init import SAMPLE_CONF, prepare_config
+from nikola.plugins.command.init import SAMPLE_CONF, prepare_config, format_default_translations_config
LOGGER = utils.get_logger('import_wordpress', utils.STDERR_HANDLER)
@@ -136,6 +136,9 @@ class CommandImportWordpress(Command, ImportMixin):
self.separate_qtranslate_content = options.get('separate_qtranslate_content')
self.translations_pattern = options.get('translations_pattern')
+ # A place holder where extra language (if detected) will be stored
+ self.extra_languages = set()
+
if not self.no_downloads:
def show_info_about_mising_module(modulename):
LOGGER.error(
@@ -164,6 +167,8 @@ class CommandImportWordpress(Command, ImportMixin):
self.import_posts(channel)
+ self.context['TRANSLATIONS'] = format_default_translations_config(
+ self.extra_languages)
self.context['REDIRECTIONS'] = self.configure_redirections(
self.url_map)
self.write_urlmap_csv(
@@ -326,7 +331,7 @@ class CommandImportWordpress(Command, ImportMixin):
size_key = b'sizes'
file_key = b'file'
- if not size_key in metadata:
+ if size_key not in metadata:
continue
for filename in [metadata[size_key][size][file_key] for size in metadata[size_key]]:
@@ -452,6 +457,7 @@ class CommandImportWordpress(Command, ImportMixin):
out_content_filename \
= utils.get_translation_candidate(self.context,
slug + ".wp", lang)
+ self.extra_languages.add(lang)
meta_slug = slug
else:
out_meta_filename = slug + '.meta'