Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization not work in the customization widget template #17269

Open
gaojianzhuang opened this issue Dec 21, 2024 · 3 comments
Open

Localization not work in the customization widget template #17269

gaojianzhuang opened this issue Dec 21, 2024 · 3 comments

Comments

@gaojianzhuang
Copy link

gaojianzhuang commented Dec 21, 2024

Describe the bug

I have enabled all the culture, localization-related features, and search forms. When I used the built-in search form widget in the layout, the localization worked well when I switched to a different language. But if I created a customization widget template in the backend. The localization would not work anymore when I changed the language.
image

Orchard Core version

orchardcore 2.1.0

image

To Reproduce

  1. Go to 'https://localhost:5001/Admin/'
  2. Click on 'https://localhost:5001/Admin/Templates'
  3. Add the "Widget__SearchForm" template.
  4. Go to the front-end page.
  5. Switch to a different language, the search form always displays the English version. But if I delete the "Widget__SearchForm" template, the issue will be resolved.
    image

Expected behavior

The localization should work well if I use the widget template created in the backend.
zh-CN:
image
en-US:
image

It seems like the "{{ "Enter your search term(s)" | t }}" code does not work in the template data.

Logs and screenshots

zh-CN:
image
en-US
image

@Piedone
Copy link
Member

Piedone commented Dec 21, 2024

I guess the PO identifiers don't match for the admin template. @hishamco perhaps you can chime in?

@hishamco
Copy link
Member

If those are custom localization resources you need to define them in PO files, try to add zh-CN.po in the Localization folder add the entires then have a try

@gaojianzhuang
Copy link
Author

gaojianzhuang commented Dec 25, 2024

If those are custom localization resources you need to define them in PO files, try to add zh-CN.po in the Localization folder add the entires then have a try

The "zh-CN.po" file already exists in the "Localization" folder and the translation key exists in the po file. It just doesn't work in the customization template data which was created in the backend template, but it works fine in the template file.
image

If I remove the template data in the admin backend, the "searchForm" will render the "SearchForm.liquid" template file in the dll file and it will work well.

It seems like the "{{ "Enter your search term(s)" | t }}" code not work in the template data context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants