WPML & WPML All Import
Your site has (default) content that does not have related translated content, and vice versa (posts created in a secondary language do not have an original alanguage translation).
It seems the WPML/WPAllImport integration (https://wpml.org/documentation/related-projects/wpml-all-import-plugin-website-import-with-wpml/) is not setup to handle this, it only works where this is a parent language that has already imported that it can link to by matching a “connecting key”. It is impossible to just create posts in a secondary (non-default) language, such as French, German etc for us. There is no way to just import French content independently of the primary language.
These posts however seem to contradict this:
- https://wpml.org/forums/topic/wp-all-import-add-on-doesnt-link-languages-between-them-not-connected/
- https://wpml.org/forums/topic/trouble-with-wpml-all-import/
Import Files
If you are uploading posts that don’t have an original translation, you will just need to make sure that they don’t have the same identifier of a previous post.
https://wpml.org/forums/topic/trouble-with-wpml-all-import/
Since I assume they are not the same post IDs because they were in separate sites, it might be best to import the original posts using a CSV file so that you can set up a unique identifier for both/all languages.
“Drag the field that you are using as the “connector” (see above) to the “Unique Identifier” field. This field “Unique Identifier” must be exactly the same to “Unique identifier” of the 1st (default) import.“
https://wpml.org/documentation/related-projects/wpml-all-import-plugin-website-import-with-wpml/.
When you import your original language, the last step of that import enables you to set a “Unique identifier”. With your 2nd import, you need to insert the exact same value of “Unique identifier” in the step 1 to “Unique Key”. You should drag the unique WPML “Connector” field (below) to the “unique identifier” field.
“My mistake was letting the plugin fill automatically and not modify the second Unique Identifier. It’s the actual Unique Identifier value that WPALL Import generates (or asks you to enter) on it’s final screen before import. This is the value that needs to be placed in the “Unique Identifier” field on the edit template screen not the connector ID that you have used to link translations in each file.”
The Unique Identifier
It is best to use a truly unique identifier, not a field that already exists in the post.
- Add a new column to your file and create the unique ID (1,2,3,4,5,etc) and see if that works for the import.
- The unique identifier field should be a column that you manually create in the CSV files
- In the documentation, WPML use a column called “Connector”
- This should be the only field dropped into the unique identifier field of the import
The connector field is used to link translated posts together. If the blog posts already exist in one language, you might be able to use the post ID as the connector.
You need a parent import first to be able to import the secondary language content using WPML All Import. Then it is is possible to import into your second language. If you don’t have a first import, it is not possible.
https://wpml.org/forums/topic/importing-second-language-without-importing-default-language-wp-all-import/
See https://wpml.org/documentation/related-projects/wpml-all-import-plugin-website-import-with-wpml/#how-to-prepare-csv-xml-files for more info.
Taxonomies
Even if the category is the same text, is it not the same entry in the database. All taxonomies that are translated have their own IDs and need to be synchronised between languages to show up correctly. Attributes need to be translated BEFORE import or else they won’t be linked.
You must create the exact same taxonomies before the import as the ones you are importing your products with.
https://wpml.org/forums/topic/not-able-to-import-all-products-using-csv-file-in-two-languages/
If the taxonomy fields are set to copy, then the values should be copied over to the translated product. You can see which fields are set to copy at WPML -> Translation Management -> Multilingual Content Setup.
By default a UK slug of /blog will be translated to have -de appended to the slug (e.g. /blog-de) on the German site.
“Terms should not have the exact same name in the original and translated languages, otherwise, the import of the translated terms will not function properly. If terms have the same name in multiple languages, it is recommended that you change the name of the terms in the translated terms before import. After successful import, you could change the name of the translated term to be the same as the original term.”
Forcing An Update
If the above doesn’t work, you may have to force an update to posts in the original language, and then translated language as follows. Do this first in the original language and then in the translated language and this should sync the copied fields.
- Go to Posts/pages.
- Select All
- Click on Bulk actions
- Select Edit.
- Click Apply.
- Without selecting any specific action, click on the button “Update”.
Tech Details
- WPML Tables https://wpml.org/documentation/support/wpml-tables/
- The table that controls the translation status is _icl_translations.
- The IDs of the original posts have all assigned a translation ID (TRIDs), that is shown in the column trid.
- “WPML seems to create TRIDs by itself at random points”
- The source language for this is NULL, to indicate that this is the original language.
- Use wpml_set_element_language_details to set the language
- $language_code – If missing or NULL, it will use the current language.
- https://wpml.org/forums/topic/get-translated-post-id/ “set the connector ID as unique identifier for WPML to be able to associate posts to each other”
Mapping
This is listed as an advanced feature http://www.wpallimport.com/tour/advanced-features/:
“Need to map or translate data in your file before it is imported to your site? For example, maybe you already have a category structure set up on your site, but the categories in the XML or CSV file you are importing don’t match the categories on your site. You need to map the category names in your XML or CSV file to the categories on your site – Men’s Shoes in your file could become Shoes For Men on your site.
When importing categories, taxonomies, or Custom Fields, you can specify the mapping options using a visual interface. Everywhere else, you can use the wpai_util_map PHP function.”
Debug Sites
“Click below to create a personal debug installation of WordPress that includes WP All Import, WP All Export, and all of our add-ons.”
You can create complete debug site for free at http://www.wpallimport.com/debug/
Minor Edits
The ‘minor edit‘ box is is only displayed when a secondary language page is fully translated. It is not visible when pages have been separated. Be careful with the minor edit box, if you have fully connected pages and don’t select it, an update in one language can overwrite all of its translations.