enupal / translate

Translate your website templates and plugins into multiple languages for Craft CMS. Bulk translation with Google Translate or Yandex.
https://enupal.com/craft-plugins/translate
Other
10 stars 2 forks source link

Javascript error. Import file, Sync with DB, Download, ... not working #55

Closed bartdigitalpulse closed 2 years ago

bartdigitalpulse commented 2 years ago

Description

None of the buttons work in enupal-translate/index page. Tried different browsers. Disabling extensions etc... Local and staging environment.

Can't Import, Sync or download the translations.

The error I get in the inspector:

jquery.js?v=1653471114:2 Uncaught TypeError: Cannot read properties of undefined (reading 'menu')
    at s.constructor.init (enupalTranslate.js?v=1653471138:40:78)
    at s.constructor.constructor (Base.js:20:15)
    at s.constructor (Base.js:32:21)
    at new s.constructor (Base.js:32:21)
    at HTMLDocument.<anonymous> (index:529:9)
    at l (jquery.js?v=1653471114:2:30361)
    at c (jquery.js?v=1653471114:2:30663)

This line in enupalTranslate.js seems to be the culprit: var $siteMenu = $('.sitemenubtn:first').menubtn().data('menubtn').menu;

The problem is when you only have one site. There is no site menu. The bug goes away when I add a second site.

Additional info

bartdigitalpulse commented 2 years ago

Any follow up on this? We use Enupal translate for almost every project. Seems like a small issue to resolve?

andrelopez commented 2 years ago

Hi @bartdigitalpulse, Enupal Translate is designed to translate from different sites, so at least two sites are required to properly use the plugin, just curious about how are you using the plugin having only one site?

bartdigitalpulse commented 2 years ago

We have our own naming system for labels, for example 'translate.cp.volumes.icons'. So our basic setup has these already translated but to add, for example a new volume, we would use this naming system and add the correct translation using Enupal.

Why this method? We had some clients that wanted their Craft Admin panel translated after the site launched. So we had to add a lot of labels manually. Now we try to do this pro-active. The naming system makes it clear that this is something translatable instead of using 'Icons'. We're still evaluating this approach.

So in short, even if we have only 1 language we still need to translate labels like 'translate.cp.volumes.icons', 'translate.cp.fields.fieldName', etc... @andrelopez

andrelopez commented 2 years ago

@bartdigitalpulse got it thanks for sharing that, working on a fix right now

andrelopez commented 2 years ago

Hi @bartdigitalpulse We just released Enupal Translate v2.3.2 with a fix to this issue. Thanks for reporting