Merge pull request #13158 from elisseck/dev/core/544
[civicrm-core.git] / js / crm.multilingual.js
index 4de9929f0e9f65c78664f40aa108b8f72d176c70..ced31483b764ea3c3219ec6ae201d5f9ebc7c31b 100644 (file)
@@ -1,8 +1,9 @@
 // http://civicrm.org/licensing
 // JS needed for multilingual installations
 CRM.$(function($) {
-  // This is largely redundant with what the CRM.popup function would do,
-  // with the difference that this loads unconditionally regardless of ajaxPopupsEnabled setting
+  // This is partially redundant with what the CRM.popup function would do,
+  // with a small amount of added functionality,
+  // and the difference that this loads unconditionally regardless of ajaxPopupsEnabled setting
   $('body').on('click', 'a.crm-multilingual-edit-button', function(e) {
     var $el = $(this),
       $form = $el.closest('form'),
@@ -11,10 +12,12 @@ CRM.$(function($) {
     CRM.loadForm($el.attr('href'), {
       dialog: {width: '50%', height: '50%'}
     })
+      // Sync the primary language field with what the user has entered on the main form
       .on('crmFormLoad', function() {
         $('.default-lang', this).val($field.val());
       })
       .on('crmFormSubmit', function() {
+        // Sync the primary language field with what the user has entered in the popup
         $field.val($('.default-lang', this).val());
         $el.trigger('crmPopupFormSuccess');
       });