woocommerce / woocommerce-blocks

(Deprecated) This plugin has been merged into woocommerce/woocommerce
https://wordpress.org/plugins/woo-gutenberg-products-block/
GNU General Public License v3.0
403 stars 219 forks source link

Translate “search product…” #7773

Closed NinjaAtWork closed 1 year ago

NinjaAtWork commented 1 year ago

“Search product…” in input form of woocommerce search block can’t be translate . Nor the woocommerce translate neither through the woocommerce block plugin translate by loco has no effect Help how to translate this sentence.

nielslange commented 1 year ago

Hello @NinjaAtWork 👋

Thanks for taking time to reach out. I just looked up this issue on a fresh WordPress installation using German and I do see the translation appearing in the Product Search block:

Screenshot 2022-11-29 at 18 10 55

I went ahead, installed the Loco Translate plugin, looked up the German translation for Search products…, changed it from Produkte suchen … to Produkte durchsuchen … and then removed the Product Search block and re-added it again. Doing that resulted in the expected translation:

Screenshot 2022-11-29 at 18 18 58 Screenshot 2022-11-29 at 18 19 15

To troubleshoot the problem you're facing, can you please post the exact steps that you tried? Is it possible that you're using a language where this particular string is not translated yet? In terms of Loco Translate, have you removed and re-added the corresponding block after you updated the translation?

NinjaAtWork commented 1 year ago

thanks for reply if you see German translate without Loco then why i cant see Persian translate? is there any .po / .mo for Persian which i am missing? it will read the translate from woocommerce itself or from the woocommerce block ? i used a fresh install like you but it was in English while the site is in persian at the other hand woocommerce is 100% in persian translated then i have installed the woocommerce block plugin and making new language in loco for both custom/system and translate that sentence and no effect in front-end.

search2 loco-system loco-custom

what should i do? here i have host stage and everything can be modified with no problem.

nielslange commented 1 year ago

if you see German translate without Loco then why i cant see Persian translate?

The plugin is translated by volunteers via https://translate.wordpress.org/projects/wp-plugins/woo-gutenberg-products-block/. The translation page for Persian can be found on https://translate.wordpress.org/locale/fa/default/wp-plugins/woo-gutenberg-products-block/. Currently, only 14% of the plugin have been translated. That translation page also shows the following information:

Translations for the readme are published almost immediately. The initial language pack for the plugin will be generated when 90% of the Stable (latest release) sub-project strings have been translated (currently 14%).

This explains why some translations, e.g. German (88% translated) or Spanish (100% translated) are visible, while other translations, e.g. Persian (14% translated), are not visible yet.

As mentioned before, translations are done by volunteers. In case you want to contribute with translations, on https://make.wordpress.org/polyglots/handbook/translating/glotpress-translate-wordpress-org/#getting-started you can find information on how to get started.

is there any .po / .mo for Persian which i am missing? it will read the translate from woocommerce itself or from the woocommerce block ?

When installing Persian via /wp-admin/options-general.php, both fa_IR.mo and fa_IR.po will be fetched into the language folder of your site, which is located under /wp-content/languages. Next, you need to head over to /wp-admin/update-core.php to fetch the Persian translations for the installed plugins and themes. Given that WooCommerce Blocks hasn’t been translated >= 90%, you’ll not receive the translations or the .po or .mo file for WooCommerce Blocks. However, WooCommerce Blocks has a fallback mechanism for translations. If a certain translation is not available in the WooCommerce Blocks translation file, the plugin will look for the corresponding string in the WooCommerce translation files. If you look up /wp-content/languages/plugins, you should see the following files:

then I have installed the woocommerce block plugin and making new language in loco for both custom/system and translate that sentence and no effect in front-end.

This might be related to caching. I suggest that you update the translation in Loco Translate, then head over to the page/post where you added the Product Search block, delete that block and save the page/post. Next, please hard refresh the page/post. Now, please add the Product Search block again. You should now be able to see the expected translation within the Product Search block.

I hope this helps to get the Product Search block translated.

NinjaAtWork commented 1 year ago

thanks for suggestion. i think the: "fallback mechanism" you mentioned is not working here. because woocommerce translation is at 100%

honestly we can't install more plugin specially the one that is bundled with woocommerce just for one sentence translation. kindly please polish the "search product..." to be loaded from woocommerce .po/.mo in fallback. or change it as a placeholder just like the wordpress search block.

nielslange commented 1 year ago

"fallback mechanism" you mentioned is not working here. because woocommerce translation is at 100%

I just double-checked this case and I do see the Product Search block appearing in Persian using the translation from WooCommerce core:

Screenshot 2022-12-07 at 13 12 28

These are the steps I've taken to get the result as seen in the screenshot:

  1. Head over to /wp-admin/options-general.php and install Persian.
  2. Head over to /wp-admin/update-core.php, click on بررسی دوباره. and fetch translations within the section ترجمه‌ها.
  3. Create a page or post and add the Product Search block which is named جستجوی محصول in Persian.
NinjaAtWork commented 1 year ago

Hi Hello everything solved after looking at your screenshot. the problem was due to admin profile language. website language was Persian but we used to work in ENG always in dashboard and after reverting to Persian language i got able to see "جستجوی محصول" block which was "Search Block" before. replaced these Blocks then again set ENG as dashboard language. so much thanks for help and being aside with me. 👍

nielslange commented 1 year ago

everything solved after looking at your screenshot.

I'm pleased to hear that the problem is resolved!

so much thanks for help and being aside with me.

You're very welcome! 😀