Closed psusu closed 2 years ago
A screenshot.
Here, to avoid the problem, both translations were added in the same default label/description field.
Hi @canonex
I've just updated the PR, could you test it?
Hi @JoryHogeveen thank you for the update, is a strong enhancement and is very helpful. After some tests I noticed that the update works fine only if current administrator has the same language of the wp default language set in options.
If you have two or more users with different languages you'll see that sometimes the main strings (label and description) will be overwritten automatically with the translations set in the translation area. I'm using WP User Switch to check this behaviour.
for example: you have two languages, EN_us and IT_it, the default language is EN. If the administrator (with IT_it language) create some fields with label in English and translation in Italian he'll end to save a field with label in italian and translation in italian (same for description field).
Another remark: microcopy for some fields isn't customizable ("add new" button in relation field, "Select Color" in color field) Those are general indications, maybe could be translated with pods PO/MO File? Other fields like yes/No need some more translation fields. Thank you!
Hi @psusu
If the administrator (with IT_it language) create some fields with label in English and translation in Italian he'll end to save a field with label in italian and translation in italian (same for description field).
Noticed this just now and I believe this is a bug introduced with this PR. I'll look into this!
Another remark: microcopy for some fields isn't customizable ("add new" button in relation field, "Select Color" in color field) Those are general indications, maybe could be translated with pods PO/MO File? Other fields like yes/No need some more translation fields.
Correct, these translations are done by translating Pods. It might be a nice enhancement to allow overwrites in these fields but that would be a separate feature request. I will however take a look at the yes/no field and see if I can already fix that in this update.
I've added some extra fixes to the PR, thank you for pointing out the bug. The issue was that I did prevent overwrites on the edit page but while saving Pods it uses the REST API and the filters where still active.
Please test again if you have the time!
EDIT: I've also added Boolean (Yes/No) labels to translations!
EDIT 2: I've added two issues and patches for other field labels: Color field: #6274 Pick field: #6277
Hi @JoryHogeveen Now seems to work correctly! The boolean labels work fine.
I have to test Color field and pick field too. I've seen the fields but I can't see the text change, so I'll do some other tests.
Hi @psusu The color and pick field are separate from this patch, you cannot test translations yet! Thank you for testing and your feedback!
Added the new field labels in the i18n component through: https://github.com/pods-framework/pods/commit/8975248f77a0ff2172867692628506b2624ca6fe
Description
I've found an issue using "translate pods" component: translate pods not translating if default is set.
It works well with labels translations but I've found some weird behaviours with field description and other elements like buttons and selectors text. If the default value isn't defined (for example if I leave the description field empty) the translation works well, if the defalut value is already defined the translation doesn't work. For some fields - for example the relationship field - the default button text "add New" is defined and is not possible to customize (and for example leave it blank for some workarounds...). I've made some tests and I've found that the
add_filter( 'pods_whatsit_get_description', array( $this, 'translate_description' ), 10, 2 );
in PodsI18n.php
is not called if default description field is already defined.
Testing instructions
Expected behavior
Labels, descriptions, buttons microcopy get correctly translated.
Possible workaround
Use a dummy default language for wordpress, leave blank the default description and the microcopy and use only transation fields. Se different languages from the default one for users. (not everything is editable, isn't a good solution for all needs)
Pods version
Other super helpful information
WordPress Environment
``` ` ### wp-core ### version: 5.8.1 site_language: it_IT user_language: en_US timezone: Europe/Rome permalink: /%postname%/ https_status: true multisite: false user_registration: 0 blog_public: 1 default_comment_status: closed environment_type: production user_count: 29 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: /home/*/public_html/project wordpress_size: 841,32 MB (882187063 bytes) uploads_path: /home/*/public_html/project/wp-content/uploads uploads_size: 1,57 GB (1682436792 bytes) themes_path: /home/*/public_html/project/wp-content/themes themes_size: 3,62 MB (3794195 bytes) plugins_path: /home/*/public_html/project/wp-content/plugins plugins_size: 43,24 MB (45340921 bytes) database_size: 37,22 MB (39026688 bytes) total_size: 2,47 GB (2652785659 bytes) ### wp-dropins (1) ### db.php: true ### wp-active-theme ### name: Mc-project (mc-project) version: 0.1.0 author: Brixel author_website: https://www.brixel.it/ parent_theme: Twenty Twenty-One (twentytwentyone) theme_features: core-block-patterns, widgets-block-editor, automatic-feed-links, title-tag, post-formats, post-thumbnails, menus, html5, custom-logo, customize-selective-refresh-widgets, wp-block-styles, align-wide, editor-styles, editor-style, editor-font-sizes, custom-background, editor-color-palette, editor-gradient-presets, responsive-embeds, custom-line-height, experimental-link-color, custom-spacing, custom-units, widgets theme_path: /home/*/public_html/project/wp-content/themes/mc-project auto_update: Disabled ### wp-parent-theme ### name: Twenty Twenty-One (twentytwentyone) version: 1.4 author: the WordPress team author_website: https://wordpress.org/ theme_path: /home/*/public_html/project/wp-content/themes/twentytwentyone auto_update: Disabled ### wp-plugins-active (12) ### Limit Login Attempts Reloaded: version: 2.23.2, author: Limit Login Attempts Reloaded, Auto-updates disabled Pods - Custom Content Types and Fields: version: 2.8.3, author: Pods Framework Team, Auto-updates disabled Polylang: version: 3.1.2, author: WP SYNTEX, Auto-updates disabled Query Monitor: version: 3.7.1, author: John Blackbourn, Auto-updates disabled User Switching: version: 1.5.8, author: John Blackbourn & contributors, Auto-updates disabled ### wp-media ### image_editor: WP_Image_Editor_GD imagick_module_version: Not available imagemagick_version: Not available imagick_version: Not available file_uploads: File uploads is turned off post_max_size: 64M upload_max_filesize: 64M max_effective_size: 64 MB max_file_uploads: 20 gd_version: 2.2.5 gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM ghostscript_version: 9.27 ### wp-server ### server_architecture: Linux 4.19.0-18-amd64 x86_64 httpd_software: Apache php_version: 7.3.31-2+0~20211022.89+debian10~1.gbp745ac7 64bit php_sapi: apache2handler max_input_variables: 1000 time_limit: 60 memory_limit: 512M max_input_time: 60 upload_max_filesize: 64M php_post_max_size: 64M curl_version: 7.64.0 OpenSSL/1.1.1d suhosin: false imagick_availability: false pretty_permalinks: true htaccess_extra_rules: true ### wp-database ### extension: mysqli server_version: 10.3.31-MariaDB-0+deb10u1 client_version: mysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $ ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /home/*/public_html/project/wp-content WP_PLUGIN_DIR: /home/*/public_html/project/wp-content/plugins WP_MEMORY_LIMIT: 40M WP_MAX_MEMORY_LIMIT: 512M WP_DEBUG: true WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_LOCAL_DEV: undefined DB_CHARSET: utf8 DB_COLLATE: undefined ### wp-filesystem ### wordpress: not writable wp-content: writable uploads: writable plugins: writable themes: writable ### pods ### pods-server-software: Apache pods-user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0 pods-session-save-path: /var/lib/php/sessions pods-session-save-path-exists: Yes pods-session-save-path-writable: Yes pods-session-max-lifetime: 1440 pods-opcode-cache-apc: No pods-opcode-cache-memcached: No pods-opcode-cache-opcache: Yes pods-opcode-cache-redis: No pods-object-cache-apc: No pods-object-cache-apcu: No pods-object-cache-memcache: No pods-object-cache-memcached: No pods-object-cache-redis: No pods-memory-current-usage: 9.958M pods-memory-current-usage-real: 2.000M pods-network-wide: No pods-install-location: /home/*/public_html/project/wp-content/plugins/pods/ pods-developer: No pods-tableless-mode: No pods-relationship-table-enabled: Yes pods-light-mode: No pods-strict: No pods-allow-deprecated: Yes pods-api-cache: Yes pods-shortcode-allow-evaluate-tags: No pods-sessions: Disable sessions pods-can-use-sessions: Yes ### pll_options ### browser: 1 rewrite: 1 hide_default: 1 force_lang: 1 redirect_lang: 0 media_support: 1 sync: taxonomies, post_meta post_types: post, page, wp_block, attachment, card, event, card-product taxonomies: category, post_tag, certification, circularity, typology, material, network domains: 0 version: 3.1.2 previous_version: 3.1.1 default_lang: it ### pll_language_it ### term_id: 1873 name: Italiano slug: it term_group: 0 term_taxonomy_id: 1873 count: 3477 tl_term_id: 1874 tl_term_taxonomy_id: 1874 tl_count: 690 locale: it_IT is_rtl: 0 w3c: it-IT facebook: it_IT home_url: https://bisonx.bisonx.lab/~*/project/ search_url: https://bisonx.bisonx.lab/~*/project/ mo_id: 11743 page_on_front: 0 page_for_posts: 0 flag_code: it flag_url: https://bisonx.bisonx.lab/~*/project/wp-content/plugins/polylang/flags/it.png custom_flag_url: 0 ### pll_language_fr ### term_id: 1876 name: Français Sénégal slug: fr term_group: 0 term_taxonomy_id: 1876 count: 1 tl_term_id: 1877 tl_term_taxonomy_id: 1877 tl_count: 193 locale: fr_FR is_rtl: 0 w3c: fr-FR facebook: fr_FR home_url: https://bisonx.bisonx.lab/~*/project/fr/ search_url: https://bisonx.bisonx.lab/~*/project/fr/ mo_id: 11744 page_on_front: 0 page_for_posts: 0 flag_code: sn flag_url: https://bisonx.bisonx.lab/~*/project/wp-content/plugins/polylang/flags/sn.png custom_flag_url: 0 ### pll_language_en ### term_id: 1881 name: English slug: en term_group: 0 term_taxonomy_id: 1881 count: 1 tl_term_id: 1882 tl_term_taxonomy_id: 1882 tl_count: 164 locale: en_US is_rtl: 0 w3c: en-US facebook: en_US home_url: https://bisonx.bisonx.lab/~*/project/en/ search_url: https://bisonx.bisonx.lab/~*/project/en/ mo_id: 11745 page_on_front: 0 page_for_posts: 0 flag_code: gb flag_url: https://bisonx.bisonx.lab/~*/project/wp-content/plugins/polylang/flags/gb.png custom_flag_url: 0 ` ```Pods Package Export
https://we.tl/t-Q9FgCOJrGL