Süleyman Kenar
Forum Replies Created
-
Forum: Plugins
In reply to: [Loco Translate] wc-admin-app.json not being generated@timwhitlock FYI, Fix for this issue will be live with the upcoming WooCommerce 7.6.0 release.
https://github.com/woocommerce/woocommerce/pull/36739Forum: Plugins
In reply to: [Dokan Vendor Dashboard] Translations not workingHello @fayeakuzzaman
I marked couple examples in screenshot below but there is much more in general.
Forum: Plugins
In reply to: [Loco Translate] wc-admin-app.json not being generatedFor people who are experiencing the same issue, you can follow the GitHub thread below for Woocommerce team’s replies. Since Loco plugin is not responsible for this issue.
Forum: Plugins
In reply to: [Loco Translate] wc-admin-app.json not being generatedThis gets even more complicated more I dig into. There is also mismatch in how translation strings stored in JSON files.
{ "translation-revision-date":"2022-11-03 19:12+0000", "generator":"Loco https:\/\/localise.biz\/", "source":"assets\/client\/admin\/date\/index.js", "domain":"woocommerce", "locale_data":{ "woocommerce":{ "":{ "domain":"woocommerce", "lang":"az", "plural-forms":"nplurals=2; plural=n != 1;" }, "Month to date":[ "Ay\u0131n \u0259vv\u0259lind\u0259n bu g\u00fcn\u0259 q\u0259d\u0259r" ], "Previous year":[ "\u018fvv\u0259lki il" ] } } }
WP-Cli and GlotPress uses [‘locale_data’][‘messages’] format for strings, while Loco uses [‘locale_data’][$textdomain] format. This also causes the same mentioned file can not read translated strings from Loco generated JSONs.
——————————————————-
Edit: Looks like for some reason the keyword “messages” is used as text-domain instead of “woocommerce”. Looks like Loco translate generates files with correct text-domain, while Woocommerce itself generates incorrect files. This needs more investigation.- This reply was modified 2 years ago by Süleyman Kenar.
Forum: Plugins
In reply to: [Loco Translate] wc-admin-app.json not being generatedI can confirm replacing $chunk_data[‘comment’][‘reference’] with $chunk_data[‘source’] in the file https://github.com/woocommerce/woocommerce/blob/0f0b2d5064079429f30e52335b66c91fcf081d44/plugins/woocommerce/src/Internal/Admin/Translations.php#L96 solves the problem.
Forum: Plugins
In reply to: [Loco Translate] wc-admin-app.json not being generated@timwhitlock I guess I found the problem.
At Line 96, the function checks if the JSON file has [“comment”][“reference”] value, which doesn’t exist in the generated JSON file. Translations downloaded from remote server and manually generated have different scheme. Here is the comparison for the same file.
This is remotely downloaded original Woocommerce JSON file.
{ "translation-revision-date": "2022-11-01 19:37:59+0000", "generator": "GlotPress/4.0.0-alpha.3", "domain": "messages", "locale_data": { "messages": { "": { "domain": "messages", "plural-forms": "nplurals=2; plural=n > 1;", "lang": "tr" }, "Edit selected product": [ "Se?ili ürünü düzenle" ] } }, "comment": { "reference": "packages/woocommerce-blocks/assets/js/blocks/single-product/edit/editor-block-controls.js" } }
And this is generated JSON file.
{ "translation-revision-date": "2022-11-02 17:33+0300", "generator": "WP-CLI\/2.7.1", "source": "packages\/woocommerce-blocks\/assets\/js\/blocks\/single-product\/edit\/editor-block-controls.js", "domain": "messages", "locale_data": { "messages": { "": { "domain": "messages", "lang": "az", "plural-forms": "nplurals=2; plural=n > 1;" }, "Edit selected product": [ "Se\u00e7ili \u00fcr\u00fcn\u00fc d\u00fczenle" ] } } }
As you can see, because generated file doesn’t have [“comment”][“reference”], Woocommerce function ignores it while generating the wc-admin-app.json file.
Forum: Plugins
In reply to: [Loco Translate] wc-admin-app.json not being generated@timwhitlock Thanks for the reply. I read the topics you mentioned and tried some hacks to force Woocommerce generate the file but no luck yet. If I manage somehow, I’ll post here for future referances.