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

Fix qtranslate-x import #3275

Merged
merged 6 commits into from
Jul 21, 2019
Merged

Conversation

tibonihoo
Copy link
Contributor

Pull Request Checklist

  • I’ve read the guidelines for contributing.
  • I updated AUTHORS.txt and CHANGES.txt (if the change is non-trivial) and documentation (if applicable).
  • I tested my changes.

Description

Make the import of an old wordpress blog with content generate from various generations (yes "generations"... :) ) of qtranslate plugins work smoother. Including the ability to recover translation titles (provided that the user does a little bit of hacking on wordpress side as docummented here)

Concerns image attachment medata and I observed the bug for old french
posts of mine => an exception occured because floats were saved and
exported with a ',' instead of a '.'
This fixes wordpress import error when there are translations.

- The "context" provided to get the translation candidate was the
context to generate the config file and not the actual dictionary of
options (resulting in TRANSLATIONS being a string instead of the
expected dict)

- If user forgot to provide one (with the qtranslate mode), the import
would fail for not finding any key 'TRANSLATIONS_PATTERN'.
This supports "up to" qtranslateX format for translations.

It also allows to recover the titles' translation on the condition
that the wordpress exports is made with the following specific hack
taken from qtranslate/qtranslate-xt#199 :

```
In wp-admin/includes/export.php change
`echo apply_filters( 'the_title_rss', $post->post_title );

to
`echo apply_filters( 'the_title_export', $post->post_title );
```
@Kwpolska
Copy link
Member

Please fix pydocstyle warnings:

nikola/plugins/command/init.py:175 in public function `get_default_translations_dict`:
        D400: First line should end with a period (not "'")
nikola/plugins/command/import_wordpress.py:1214 in public function `modernize_qtranslate_tags`:
        D205: 1 blank line required between summary line and description (found 0)
nikola/plugins/command/import_wordpress.py:1214 in public function `modernize_qtranslate_tags`:
        D400: First line should end with a period (not 's')

@tibonihoo
Copy link
Contributor Author

Please fix pydocstyle warnings

Sure, sorry for missing those.

Copy link
Member

@Kwpolska Kwpolska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Kwpolska Kwpolska merged commit 041717c into getnikola:master Jul 21, 2019
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.

None yet

2 participants