moveLanguage(languageCode, moveType) {
      let languageCodes = this.settingsPrefs_.prefs.intl.accept_languages.value;
      let languages = languageCodes.split(',');
      const index = languages.indexOf(languageCode);

      if (moveType == chrome.languageSettingsPrivate.MoveType.TOP) {
        if (index < 1)
          return;

        languages.splice(index, 1);
        languages.unshift(languageCode);
      } else if (moveType == chrome.languageSettingsPrivate.MoveType.UP) {
        if (index < 1)
          return;

        let temp = languages[index - 1];
        languages[index - 1] = languageCode;
        languages[index] = temp;
      } else if (moveType == chrome.languageSettingsPrivate.MoveType.DOWN) {
        if (index == -1 || index == languages.length - 1)
          return;

        let temp = languages[index + 1];
        languages[index + 1] = languageCode;
        languages[index] = temp;
      }

      languageCodes = languages.join(',');
      this.settingsPrefs_.set(
          'prefs.intl.accept_languages.value', languageCodes);
      if (cr.isChromeOS) {
        this.settingsPrefs_.set(
            'prefs.settings.language.preferred_languages.value', languageCodes);
      }
    }
/**
     * Moves a language inside the language list.
     * Movement is determined by the |moveType| parameter.
     * @param {string} languageCode
     * @param {chrome.languageSettingsPrivate.MoveType} moveType
     */
Moves a language inside the language list.
Movement is determined by the |moveType| parameter.
Moves a language inside the language list . Movement is determined by the |moveType| parameter .
moveLanguage(languageCode, moveType) {
      let languageCodes = this.settingsPrefs_.prefs.intl.accept_languages.value;
      let languages = languageCodes.split(',');
      const index = languages.indexOf(languageCode);
      if (moveType == chrome.languageSettingsPrivate.MoveType.TOP) {
        if (index < 1)
          return;
        languages.splice(index, 1);
        languages.unshift(languageCode);
      } else if (moveType == chrome.languageSettingsPrivate.MoveType.UP) {
        if (index < 1)
          return;
        let temp = languages[index - 1];
        languages[index - 1] = languageCode;
        languages[index] = temp;
      } else if (moveType == chrome.languageSettingsPrivate.MoveType.DOWN) {
        if (index == -1 || index == languages.length - 1)
          return;
        let temp = languages[index + 1];
        languages[index + 1] = languageCode;
        languages[index] = temp;
      }
      languageCodes = languages.join(',');
      this.settingsPrefs_.set(
          'prefs.intl.accept_languages.value', languageCodes);
      if (cr.isChromeOS) {
        this.settingsPrefs_.set(
            'prefs.settings.language.preferred_languages.value', languageCodes);
      }
    }
moveLanguage ( languageCode , moveType ) { let languageCodes = this . settingsPrefs_ . prefs . intl . accept_languages . value ; let languages = languageCodes . split ( ',' ) ; const index = languages . indexOf ( languageCode ) ; if ( moveType == chrome . languageSettingsPrivate . MoveType . TOP ) { if ( index < 1 ) return ; languages . splice ( index , 1 ) ; languages . unshift ( languageCode ) ; } else if ( moveType == chrome . languageSettingsPrivate . MoveType . UP ) { if ( index < 1 ) return ; let temp = languages [ index - 1 ] ; languages [ index - 1 ] = languageCode ; languages [ index ] = temp ; } else if ( moveType == chrome . languageSettingsPrivate . MoveType . DOWN ) { if ( index == - 1 || index == languages . length - 1 ) return ; let temp = languages [ index + 1 ] ; languages [ index + 1 ] = languageCode ; languages [ index ] = temp ; } languageCodes = languages . join ( ',' ) ; this . settingsPrefs_ . set ( 'prefs.intl.accept_languages.value' , languageCodes ) ; if ( cr . isChromeOS ) { this . settingsPrefs_ . set ( 'prefs.settings.language.preferred_languages.value' , languageCodes ) ; } }
Moves a language inside the language list.
Moves a language inside the language list .