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

Summernote fails to initiliaze when using multiple locale #10259

Closed
MarvinKlein1508 opened this issue Nov 3, 2021 · 12 comments
Closed

Summernote fails to initiliaze when using multiple locale #10259

MarvinKlein1508 opened this issue Nov 3, 2021 · 12 comments

Comments

@MarvinKlein1508
Copy link

What version of OpenCart are you reporting this for?
3.0.3.8

Describe the bug
Summernote

To Reproduce
Steps to reproduce the behavior:

  1. Go to admin->settings->languages
  2. Click on edit
  3. Create multiple locale identifiers. E.g.
  4. Try to visit any site which uses summernote within admin
  5. See error in console:
GEThttps://DOMAIN/admin/view/javascript/summernote/lang/summernote-de,de-de,de-DE,de_DE,german,de_DE.UTF-8,de-de.UTF-8,german.UTF-8-DE,DE-DE,DE-DE,DE_DE,GERMAN,DE_DE.UTF-8,DE-DE.UTF-8,GERMAN.UTF-8.min.js
[HTTP/2 404 Not Found 26ms]

Uncaught SyntaxError: expected expression, got '<'
    jQuery 11
    <anonymous> https://www.nobel-hobel.de/admin/view/javascript/summernote/opencart.js:8
    jQuery 2
    <anonymous> https://www.nobel-hobel.de/admin/view/javascript/summernote/opencart.js:3
    jQuery 8

Expected behavior
Summernote should not fail initialzing when multiple local identifiers are defined

Screenshots / Screen recordings
grafik

grafik

Server / Test environment (please complete the following information):

  • PHP version 8
  • Browser(s) tested with Chrome and Firefox

Additional context
only specifying a single locale willl result in working summernote. For example: de however when I be more specific it fails again. For example: de-de

@osworx
Copy link
Contributor

osworx commented Nov 3, 2021

Well, it's quite stupid doing it this way with language.locale:

<textarea name="product_description[{{ language.language_id }}][description]" placeholder="{{ entry_description }}" id="input-description{{ language.language_id }}" data-toggle="summernote" data-lang="{{ language.locale }}" class="form-control">{{ product_description[language.language_id] ? product_description[language.language_id].description }}</textarea>

While the language file has already the correct definiton(s) summernote:

And no need to use ISO 639-1 format (which is btw. only a 2-letter code!).

And the language definition code should be the same as the directory.
While locale is used for other purpose (e.g. cookies) - don't touch that!

@osworx
Copy link
Contributor

osworx commented Nov 3, 2021

only specifying a single locale willl result in working summernote. For example: de however when I be more specific it fails again. For example: de-de

It should be de-DE (because all OpenCart packages have the summernote languages like xx-YY.js).
Don't know from where you have the de.js, I assume you are using my German translation ..

@MarvinKlein1508
Copy link
Author

It should be de-DE (because all OpenCart packages have the summernote languages like xx-YY.js).

Wrong. The default for German language files in Opencart is de-de. Even your own langauge pack creates this folder.

@osworx
Copy link
Contributor

osworx commented Nov 3, 2021

It should be de-DE (because all OpenCart packages have the summernote languages like xx-YY.js).

Wrong. The default for German language files in Opencart is de-de. Even your own langauge pack creates this folder.

de-de IS the language code (and folder) - as all langauge translations should use xx-yy (and NOT xx-YY or German as seen at some).
de-DE IS the code for summernote as defined inside the main language file (also in mine).
So please don't tell me stuff ..

@webkul-dilip
Copy link
Contributor

As you suggested, we will do it in a better way, we will update you shortly.

@osworx
Copy link
Contributor

osworx commented Nov 3, 2021

Beside this "discussion", summernote use xx-YY as language codes, see:
https://github.com/summernote/summernote/tree/develop/src/lang

And what I've added to the German language pack is a reworked summernote de-DE translation because the one provided with the original packages are quite old ..

@osworx
Copy link
Contributor

osworx commented Nov 24, 2021

@webkul-dilip 21 days later - and no update or fix??
What do you understand under shortly ?

@webkul-dilip
Copy link
Contributor

@webkul-dilip 21 days later - and no update or fix?? What do you understand under shortly ?

sorry for the delay, now we have fixed the issue
#10275

@Opencart-Webkul
Copy link
Collaborator

Merged PR #10275

@MarvinKlein1508
Copy link
Author

@Opencart-Webkul when will this patch be available in an update for OC?

@opencart opencart deleted a comment from panqilin Dec 7, 2021
@osworx
Copy link
Contributor

osworx commented Dec 7, 2021

@opencart If all updates would be so fast as deleting comments, more users would be satisfied.

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

No branches or pull requests

4 participants