i18n.js 665 B

123456789101112131415161718192021
  1. (function ($) {
  2. /**
  3. * Rewrite autocomplete inputs to pass the language of the node currently being
  4. * edited in the path.
  5. *
  6. * This functionality ensures node autocompletes get suggestions for the node's
  7. * language rather than the current interface language.
  8. */
  9. Drupal.behaviors.i18n = {
  10. attach: function (context) {
  11. if (Drupal.settings && Drupal.settings.i18n) {
  12. $('form[id^=node-form]', context).find('input.autocomplete[value^=' + Drupal.settings.i18n.interface_path + ']').each(function () {
  13. $(this).val($(this).val().replace(Drupal.settings.i18n.interface_path, Drupal.settings.i18n.content_path));
  14. });
  15. }
  16. }
  17. };
  18. })(jQuery);