Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

TypeError: wp.i18n is undefined in new Mini Cart Block #6153

Closed
maeseoki opened this issue Mar 29, 2022 · 1 comment · Fixed by #6158
Closed

TypeError: wp.i18n is undefined in new Mini Cart Block #6153

maeseoki opened this issue Mar 29, 2022 · 1 comment · Fixed by #6158
Assignees
Labels
block: mini-cart Issues related to the Mini-Cart block. focus: i18n The issue/PR is related to internationalization. type: bug The issue/PR concerns a confirmed bug.

Comments

@maeseoki
Copy link

Describe the bug

With the new MiniCart Block, its inline JavScript for translation purposes is loaded before wp object and i18n object, so a few TypeError are thrown and no translation is applied.

wp.i18n.setLocaleData( localeData, domain )

To reproduce

Steps to reproduce the behavior:

  1. Go to Settings -> General and change the language of the site to any language other than English (FYI I'm using Spanish)
  2. Now go to Appearance -> Widgets and add Mini Cart widget to any Widget Area
  3. Go to any page containing that Widget Area and see error in browser console

Expected behavior

Widget string to be translated

WordPress:

  • Core version: 5.9.2
  • WooCommerce version: 6.3.1
  • WooCommerce Blocks version: 7.3.0
  • Site language: Spanish
  • Any other plugins installed: None

Desktop:

  • OS: Windows
  • Browser Firefox, Chrome
@maeseoki maeseoki added the type: bug The issue/PR concerns a confirmed bug. label Mar 29, 2022
@gigitux
Copy link
Contributor

gigitux commented Mar 29, 2022

Hello @maeseoki

Thanks for reporting this issue. I'm able to reproduce the issue. We will work for fixing the issue

@gigitux gigitux self-assigned this Mar 29, 2022
@gigitux gigitux added the block: mini-cart Issues related to the Mini-Cart block. label Mar 29, 2022
gigitux added a commit that referenced this issue Mar 29, 2022
Mini Cart block - fix translations handling
gigitux added a commit that referenced this issue Apr 1, 2022
* Mini Cart block - fix translations handling #6153

Mini Cart block - fix translations handling

* Mini Cart block - fix translations handling (#6164)

* loads translations for deps

Co-authored-by: Tung Du <[email protected]>

* address code review. load translations close to associated scripts

Co-authored-by: Tung Du <[email protected]>
tjcafferkey pushed a commit that referenced this issue Apr 5, 2022
* Mini Cart block - fix translations handling #6153

Mini Cart block - fix translations handling

* Mini Cart block - fix translations handling (#6164)

* loads translations for deps

Co-authored-by: Tung Du <[email protected]>

* address code review. load translations close to associated scripts

Co-authored-by: Tung Du <[email protected]>
@nielslange nielslange added the focus: i18n The issue/PR is related to internationalization. label May 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: mini-cart Issues related to the Mini-Cart block. focus: i18n The issue/PR is related to internationalization. type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants