Closed Kevin-JP closed 1 year ago
What is the "title" of a taxonomy term? Do you mean the name
field?
Can't reproduce anyways, tested with name
and slug
fields both for taxonomy terms and posts, and same string can be set and saved properly both for primary-secondary and secondary-secondary languages.
Can you explain better and share QTX settings > Troubleshooting > Collect information
output.
Yes, sorry, I meant the name
field.
I recorded a short video of it, hope it helps:
Basically I have a taxonomy term with the following name
:
Now whenever I try to change the german name back to "test" it still keeps the same name as before: "testDE".
Only workaround I found that doesn't require additional coding is to use "[:en]test[:de]test[:]".
Here is the Debugging Information:
{ "PHP_VERSION": "7.4.1", "WP_VERSION": "6.0.2", "QTX_VERSION": "3.12.0", "Plugins": [ "Advanced Custom Fields PRO 5.12.2", "Custom Post Type UI 1.13.1", "qTranslate-XT 3.12.0" ] }
{ "default_language": "en", "enabled_languages": [ "en", "de" ], "flag_location": "plugins/qtranslate-xt/flags/", "language_name": { "en": "English", "de": "Deutsch" }, "locale": { "en": "en_US", "de": "de_DE" }, "locale_html": { "en": "", "de": "" }, "not_available": { "en": "Sorry, this entry is only available in %LANG:, : and %.", "de": "Leider ist der Eintrag nur auf %LANG:, : und % verfügbar." }, "date_format": { "en": "%A %B %e%q, %Y", "de": "%A, \\d\\e\\r %e. %B %Y" }, "time_format": { "en": "%I:%M %p", "de": "%H:%M" }, "flag": { "en": "gb.png", "de": "de.png" }, "url_mode": 2, "use_strftime": 3, "filter_options_mode": 0, "language_name_case": 0, "detect_browser_language": true, "hide_untranslated": false, "show_displayed_language_prefix": true, "show_alternative_content": false, "hide_default_language": true, "use_secure_cookie": false, "header_css_on": true, "header_css": ".qtranxs_flag_en {background-image: url(http://local-wordpress.local/wp-content/plugins/qtranslate-xt/flags/gb.png); background-repeat: no-repeat;}\n.qtranxs_flag_de {background-image: url(http://local-wordpress.local/wp-content/plugins/qtranslate-xt/flags/de.png); background-repeat: no-repeat;}\n", "text_field_filters": [], "term_name": { "Conf": { "en": "Conf", "de": "ConfDe" }, "test": { "en": "test", "de": "test" } }, "disable_client_cookies": false, "ignore_file_types": [ "gif", "jpg", "jpeg", "png", "svg", "pdf", "swf", "tif", "rar", "zip", "7z", "mpg", "divx", "mpeg", "avi", "css", "js", "mp3", "mp4", "apk" ], "url_info": { "cookie_lang_front": "en", "cookie_lang_admin": "en", "cookie_front_or_admin_found": true, "scheme": "http", "host": "local-wordpress.local", "path": "/wp-admin/admin-ajax.php", "query": "action=admin_debug_info", "path-base": "", "wp-path": "/wp-admin/admin-ajax.php", "language_neutral_path": true, "http_referer": "http://local-wordpress.local/wp-admin/options-general.php?page=qtranslate-xt", "referer_admin": true, "doing_front_end": false, "lang_cookie_admin": "en", "lang_admin": "en", "language": "en", "set_cookie": false }, "language": "en", "editor_mode": 0, "highlight_mode": 1, "auto_update_mo": true, "hide_lsb_copy_content": false, "lsb_style": "Simple_Buttons.css", "config_files": [ "./i18n-config.json" ], "custom_i18n_config": [], "custom_fields": [], "custom_field_classes": [], "post_type_excluded": [], "admin_enabled_modules": { "acf": true, "all-in-one-seo-pack": true, "events-made-easy": true, "jetpack": true, "google-site-kit": true, "gravity-forms": true, "woo-commerce": true, "wp-seo": true, "slugs": false }, "translator": {}, "qtrans_compatibility": false }
{ "cookies": [], "navigator": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" }
Ok, it happens when the translation is the same for all languages.
It should be fixed by #1230, which will have the same effect of filling in one string only for default language, leaving the other language fields empty.
Actually this can be already done manually from admin interface rather than using [:en]test[:de]test[:]
Your fix does seem to do the trick, thank you for your help.
Actually this can be already done manually from admin interface rather than using
[:en]test[:de]test[:]
I also figured this out but the problem would have been the customer. Some of the sites I worked on have up to 4-5 different languages so I'm pretty positive that some customers wouldn't like this solution as it might not seem intuitive at the first glance for them.
I'll mark this issue as closed.
This worked already fine for post titles, so the bug is specific to terms. I re-open the ticket.
For clarification, the fix proposed in #1230 appears to work for the user with the taxonomy edit. But I will not merge it as it creates some regression with the data storage for all ML content, for example post title. When the content is the same for all languages, everything should be fused without ML tags.
This issue is specific to taxonomy and there is surely a bug in qtx_admin_taxonomy. I have observed there's something wrong here: https://github.com/qtranslate/qtranslate-xt/blob/98f8a8e1adbdd03bb80740b5e48b7563a2ac1adf/admin/qtx_admin_taxonomy.php#L145
If the term is not multilingual, the sanitization retrieves some older ML translations and assign them to q_config['terms_sanitized']
for that term. This is very old code I don't understand well so it would take more time for a fix and I'm looking at other topics with strftime and PHP 8.1.
Yes, this condition in qtranxf_term_sanitize_name_unslashed
keeps on resuming the old translation if the new name is not multilingual in this scenario (pre_term_name
hook through qtranxf_term_sanitize_name_db
).
For this issue https://github.com/qtranslate/qtranslate-xt/pull/1230/commits/2a1486fd4dcb25627795730509c2944887b55a66 should do the job.
I think there are other scenarios where current behaviour in qtranxf_term_sanitize_name_unslashed
is the intended one (qtranxf_term_get_args
hook), as for terms the name translations are stored separately and db stored term name can be used to retrieve actual translations from qtranslate options (though I did not go into detail).
Looks good now! Updated fix merged in master.
Hi,
I've searched all over the internet and didn't find any thread related to this specific issue.
So lets say I have French and German as languages and I have a taxonomy term with the title "Test" in french and "TestDE" in german.
Whenever I try to change the german title back to "Test" it doesn't get saved properly and it always keeps the old title "TestDE". This issue only occurs when I pick exactly the same title as in the other language. For example if I try to change it to "TestDE2" it works.
One workaround is to use [:fr]Test[:de]Test[:] but it isn't always easy for the customer to use.
I'm also using the latest version of qtranslate-xt.
I hope anyone could help me here, many thanks in advance.