ajax method for updating language cases in edit mode
500806
def update_language_cases
      @cases = parse_language_cases
    
      unless params[:case_action]
        return render(:partial => "edit_cases")
      end
  
      if params[:case_action].index("add_at")
        position = params[:case_action].split("_").last.to_i
        @cases.insert(position, Tr8n::LanguageCase.new(:language => tr8n_current_language))
      elsif params[:case_action].index("delete_at")
        position = params[:case_action].split("_").last.to_i
        @cases.delete_at(position)
      elsif params[:case_action].index("clear_all")
        @cases = []
      end
    
      render :partial => "edit_language_cases"      
    end
305728
def _add_locale(locale, strings)
      `t = document.createElement('template');
      document.body.appendChild(t);
      t.classList.add('i18n');
      t.setAttribute('data-lang', #{locale})`

      strings.each do |k, v|
        `e=document.createElement('p');
        t.content.appendChild(e);
        e.id=#{k.gsub('.', '-')};
        e.textContent=#{v}`
      end
    end
848508
function(id) {
            if (!$$.App) $$.App = this;
            if (!$$.App._languages) {
                // Initialise localization.
                var languages = [],
                langStyle = document.createElement("style"),
                children = document.querySelectorAll("[lang]");
                document.head.appendChild(langStyle);
                $$.App._langStyle = langStyle;
                for (var i = 0 ; i < children.length ; i++) {
                    var child = children[i];
                    lang = child.getAttribute("lang");
                    found = false;
                    for (k = 0 ; k < languages.length ; k++) {
                        if (languages[k] == lang) {
                            found = true;
                            break;
                        }
                    }
                    if (!found) {
                        languages.push(lang);
                    }
                }
                $$.App._languages = languages;
            }

            var that = this, lang, k, found, first, txt;
            languages = $$.App._languages;
            if (id === undefined) {
                // Return current language.
                lang = $$.lang();  // localStorage.getItem("wtag-language");
                if (!lang) {
                    lang = navigator.language || navigator.browserLanguage || "fr";
                    lang = lang.substr(0, 2);
                }
                $$.lang(lang);
                // localStorage.setItem("wtag-language", lang);
                return lang;
            } else {
                // Set current language and display localized elements.
                found = false;
                for (k = 0 ; k < languages.length ; k++) {
                    if (languages[k] == id) {
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    id = languages[0];
                }
                txt = "";
                first = true;
                for (k = 0 ; k < languages.length ; k++) {
                    lang = languages[k];
                    if (lang != id) {
                        if (first) {
                            first = false;
                        } else {
                            txt += ",";
                        }
                        txt += "[lang=" + lang + "]";
                    }
                }
                $$.App._langStyle.textContent = txt + "{display: none}";
                $$.lang(id);
                //localStorage.setItem("wtag-language", id);
            }
        }
522876
function () {
		var ajax = this.obj.$ajax;
		var self = this;
		var version = this.obj.getUserData(0, "version");
		var url = this.serverProcessor + ajax.urlSeparator(this.serverProcessor) + ["dhx_user=" + this._user, "dhx_version=" + version].join("&");
		url = url.replace("editing=true&", "");
		this.getUpdates(url, function (xml) {
			var vers = ajax.xpath("//userdata", xml);
			self.obj.setUserData(0, "version", self._v(vers[0]));

			var upds = ajax.xpath("//update", xml);
			if (upds.length) {
				self._silent_mode = true;

				for (var i = 0; i < upds.length; i++) {
					var status = upds[i].getAttribute('status');
					var id = upds[i].getAttribute('id');
					var parent = upds[i].getAttribute('parent');
					switch (status) {
						case 'inserted':
							self.callEvent("insertCallback", [upds[i], id, parent]);
							break;
						case 'updated':
							self.callEvent("updateCallback", [upds[i], id, parent]);
							break;
						case 'deleted':
							self.callEvent("deleteCallback", [upds[i], id, parent]);
							break;
					}
				}

				self._silent_mode = false;
			}

			self._update_busy = false;
			self = null;
		});
	}
1242322
function (event) {
            if (event.type == "dblclick" && this.controller.freeText) {
                var element = event.target;
                if (element.className.indexOf("xMultiAutoComplete_Option_Text") != -1) {
                    this._editMultiselectValue(element, event);
                }
            }
        }
1281598
@Override
  public final synchronized void handleDataChanged() throws Exception {
    this.i18nWebStoreList = null;
    this.i18nCatalogs = null;
    this.currRates = null;
    this.dlvMts = null;
    this.logger.info(null, HndlTradeVarsRequest.class,
      "I18N changes are handled.");
  }
940722
public function saveinnlang()
    {
        $sOxId = $this->getEditObjectId();
        $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");

        $oObj = oxNew(\OxidEsales\Eshop\Application\Model\SelectList::class);

        if ($sOxId != "-1") {
            $oObj->loadInLang($this->_iEditLang, $sOxId);
        } else {
            $aParams['oxselectlist__oxid'] = null;
        }

        //Disable editing for derived items
        if ($oObj->isDerived()) {
            return;
        }

        parent::save();

        //$aParams = $oObj->ConvertNameArray2Idx( $aParams);
        $oObj->setLanguage(0);
        $oObj->assign($aParams);

        // apply new language
        $oObj->setLanguage(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("new_lang"));
        $oObj->save();

        // set oxid if inserted
        $this->setEditObjectId($oObj->getId());
    }
838459
def update_translation
      @translation = current_user.translation_for @translation_key, session[:lang_to]
      @key_before_status = @translation_key.status(session[:lang_to])
      respond_to do |format|
        # only admin can edit accepted translations
        if (current_user.can_admin_translations? || !@translation.accepted?) && !params[:value].to_s.strip.blank?
          # use yaml.load to handle arrays
          @translation.update(value: YAML.load(params[:value].strip), status: 'pending')
          # translation added by admin is considered the accepted one as it is trusted
          @translation.accept if current_user.can_admin_translations? && CONFIG['accept_admin_translations']
          format.json {render json: { value: @translation.value, status: @translation.key.status(@translation.lang), key_before_status: @key_before_status  } }
        else
          format.any {render nothing: true}
        end 
      end
    end
1099810
function render(locale, translation) {
    var replacements = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    var pluralization = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;

    // get the type of the property
    var objType = _typeof(translation);

    var pluralizationType = _typeof(pluralization);

    var resolvePlaceholders = function resolvePlaceholders() {
      if (isArray$1(translation)) {
        // replace the placeholder elements in all sub-items
        return translation.map(function (item) {
          return replace(item, replacements, false);
        });
      } else if (objType === 'string') {
        return replace(translation, replacements, true);
      }
    }; // return translation item directly


    if (pluralization === null) {
      return resolvePlaceholders();
    } // check if pluralization value is countable


    if (pluralizationType !== 'number') {
      if (warnings) console.warn('i18n: pluralization is not a number');
      return resolvePlaceholders();
    } // --- handle pluralizations ---
    // replace all placeholders


    var resolvedTranslation = resolvePlaceholders(); // initialize pluralizations

    var pluralizations = null; // if translations are already an array and have more than one entry,
    // we will not perform a split operation on :::

    if (isArray$1(resolvedTranslation) && resolvedTranslation.length > 0) {
      pluralizations = resolvedTranslation;
    } else {
      // split translation strings by ::: to find create the pluralization array
      pluralizations = resolvedTranslation.split(':::');
    } // determine the pluralization version to use by locale


    var index = plurals.getTranslationIndex(locale, pluralization); // check if the specified index is present in the pluralization

    if (typeof pluralizations[index] === 'undefined') {
      if (warnings) {
        console.warn('i18n: pluralization not provided in locale', translation, locale, index);
      } // return the first element of the pluralization by default


      return pluralizations[0].trim();
    } // return the requested item from the pluralizations


    return pluralizations[index].trim();
  }
858243
function _onActiveEditorChange(event, current, previous) {
        if (previous) {
            previous.off(".statusbar");
            previous.document.off(".statusbar");
            previous.document.releaseRef();
        }

        if (!current) {
            StatusBar.hideAllPanes();
        } else {
            var fullPath = current.document.file.fullPath;
            StatusBar.showAllPanes();

            current.on("cursorActivity.statusbar", _updateCursorInfo);
            current.on("optionChange.statusbar", function () {
                _updateIndentType(fullPath);
                _updateIndentSize(fullPath);
            });
            current.on("change.statusbar", function () {
                // async update to keep typing speed smooth
                window.setTimeout(function () { _updateFileInfo(current); }, 0);
            });
            current.on("overwriteToggle.statusbar", _updateOverwriteLabel);

            current.document.addRef();
            current.document.on("languageChanged.statusbar", function () {
                _updateLanguageInfo(current);
            });

            _updateCursorInfo(null, current);
            _updateLanguageInfo(current);
            _updateEncodingInfo(current);
            _updateFileInfo(current);
            _initOverwriteMode(current);
            _updateIndentType(fullPath);
            _updateIndentSize(fullPath);
        }
    }
738665
function layoutEditorUpdateData( divId, paramsObj ) {
	log( "layout-editor", "start '"+JSON.stringify(paramsObj)+"'");
	//alert(divId+": ... try to load "+paramsObj.rowId ); 
	if ( ( paramsObj != null ) && ( paramsObj.page_id != null ) ) {
		moduleConfig[ divId ].page_id = paramsObj.page_id;
	} else { 
		paramsObj = { "page_id":moduleConfig[ divId ].page_id };
	}
	pongLayoutBackendCall( "GET", divId, paramsObj, false );
	log( "layout-editor", "end.");
}
972892
public function langUpdate()
    {
        $path = skin_path('lang'.DS.$this->module->name).DS.app_locale().'.json';
        $data = file_exists($path) ? json_decode(file_get_contents($path), true) : [];

        $data = array_filter(array_merge($data, [
            $this->name => $this->title,
            $this->name.'#descr' => $this->attributes['descr'],
            'section.' . $this->section => request('section_lang', __('section.' . $this->section)),
            'legend.' . $this->fieldset => request('legend_lang', __('legend.' . $this->fieldset)),
        ]));

        ksort($data);

        $data = json_encode($data, JSON_UNESCAPED_UNICODE);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new \RuntimeException(sprintf(
                'Translation file `%s` contains an invalid JSON structure.', $path
            ));
        }

        file_put_contents($path, $data);

        return $this;
    }
966918
function _populateLanguageDropdown() {
        // Get all non-binary languages
        var languages = _.values(LanguageManager.getLanguages()).filter(function (language) {
            return !language.isBinary();
        });

        // sort dropdown alphabetically
        languages.sort(function (a, b) {
            return a.getName().toLowerCase().localeCompare(b.getName().toLowerCase());
        });

        languageSelect.items = languages;

        // Add option to top of menu for persisting the override
        languageSelect.items.unshift("---");
        languageSelect.items.unshift(LANGUAGE_SET_AS_DEFAULT);
    }
545772
private void initLanguageSwitch(Collection<Locale> locales, Locale current) {

        FormLayout languages = new FormLayout();
        languages.setHeight("100%");
        languages.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
        ComboBox languageSelect = new ComboBox();
        languageSelect.setCaption(m_messages.key(Messages.GUI_LANGUAGE_SWITCHER_LABEL_0));
        languageSelect.setNullSelectionAllowed(false);

        // set Locales
        for (Locale locale : locales) {
            languageSelect.addItem(locale);
            String caption = locale.getDisplayName(UI.getCurrent().getLocale());
            if (CmsLocaleManager.getDefaultLocale().equals(locale)) {
                caption += " ("
                    + Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_DEFAULT_LOCALE_0)
                    + ")";
            }
            languageSelect.setItemCaption(locale, caption);
        }
        languageSelect.setValue(current);
        languageSelect.setNewItemsAllowed(false);
        languageSelect.setTextInputAllowed(false);
        languageSelect.addValueChangeListener(new ValueChangeListener() {

            private static final long serialVersionUID = 1L;

            public void valueChange(ValueChangeEvent event) {

                m_listener.handleLanguageChange((Locale)event.getProperty().getValue());

            }
        });

        if (locales.size() == 1) {
            languageSelect.setEnabled(false);
        }
        languages.addComponent(languageSelect);
        m_languageSwitch = languages;
    }
1199337
@Override
  public final synchronized void handleDataChanged() throws Exception {
    this.i18nAccountingList = null;
    this.i18nCurrencyList = null;
    this.logger.info(null, HndlAccVarsRequest.class,
      "I18N changes are handled.");
    if (this.additionalI18nReqHndl != null) {
      this.additionalI18nReqHndl.handleDataChanged();
    }
  }
1096139
function() {
        var self = this;
        this.$main.on('change', 'td[editable]', function(e, newValue) {
            var row = $(this).parent(),
                columIndex = row.find('td').index($(this)),
                rowIndex = row.parent().find('tr[class!="sum"]').index(row) / self.rowSpan;
            if (self.options.selectable) {
                columIndex = columIndex - 1;
            }
            var field = self.options.column[columIndex].field;

            // 更新 data
            self.options.data[rowIndex][field] = newValue;

            return self.options.onEdit.call(self, {
                newValue: newValue,
                field: field,
                item: self.options.data[rowIndex],
                index: rowIndex + 1
            }, e);
        });
    }
815091
function onSetLanguageCode() {
  var languageCode = $('#language-code').val() || null;
  try {
    auth.languageCode = languageCode;
    alertSuccess('Language code changed to "' + languageCode + '".');
  } catch (error) {
    alertError('Error: ' + error.code);
  }
}