Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I found that some strings are not properly added with Drupal.t() to locales_source table like through t() function. E.g. line 95 in draft.js
$('.draft_save .title').html(Drupal.t('Draft with Draft ID ' + draft_id + ' has been saved successfully'));
or line 134 in draft.module
drupal_add_js('$(document).ready(function() { $(".draft_save .title").html(Drupal.t("Populating Draft form")).parent().slideDown(); setTimeout(Drupal.draft.populateForm, 2000); });', 'inline');
Didn't find the way how to translate these strings. Any suggestions for that?
Comment | File | Size | Author |
---|---|---|---|
#6 | 938118-draft-js-translations-6.patch | 1.82 KB | lotyrin |
#4 | 938118-draft-js-translations-4.patch | 1.81 KB | lotyrin |
Comments
Comment #1
boreg CreditAttribution: boreg commentedSomeone should really notice this issue. It's essential if you want to use Draft within other languages. Really no suggestion?
Comment #2
darren.ferguson CreditAttribution: darren.ferguson commentedYou can check with the core translation team they might have ideas since it is using the drupal translation as it was asked for. Maybe it is not being used correctly in draft but to my knowledge this was how to translate via JavaScript.
Comment #3
lotyrin CreditAttribution: lotyrin commentedsub
Comment #4
lotyrin CreditAttribution: lotyrin commentedLocale doesn't know to look for Drupal.t() in .module files. Besides, all of the other messages were already out in draft.js. For consistency I moved it, so it is now working properly. I also added the ellipsis, since the other messages of this type use this pattern.
For the other string, you can't translate a dynamic string, you have to use t()'s replacement if the string is at all dynamic.
The module should now be able to be localized properly.
Comment #5
darren.ferguson CreditAttribution: darren.ferguson commentedYou have removed the timeout on the draft.populateform which was put in place because if people are on a slow connection the WSYWIG component would not be available since it would still be downloading all of its components. The 2 seconds was there as a stop gap to make sure the javascript for the WSYWIG component actually was run. Other than that it looked okay, if that was re-added i think the patch could be added too the module.
Comment #6
lotyrin CreditAttribution: lotyrin commentedAttempting to provide a new patch without the accidentally removed timeout, but Drupal.org seems to be having file attachment problems. I'll cross my fingers.