|
| 1 | +import classNames from 'classnames'; |
| 2 | +import { sortBy } from 'lodash'; |
1 | 3 | import PropTypes from 'prop-types'; |
2 | 4 | import React from 'react'; |
3 | | -import { connect } from 'react-redux'; |
4 | | -import { withRouter } from 'react-router'; |
5 | | -import { Link } from 'react-router'; |
6 | | -import classNames from 'classnames'; |
7 | 5 | import { withTranslation } from 'react-i18next'; |
8 | | -import { languageKeyToLabel } from '../i18n'; |
| 6 | +import { connect } from 'react-redux'; |
| 7 | +import { Link, withRouter } from 'react-router'; |
| 8 | +import { availableLanguages, languageKeyToLabel } from '../i18n'; |
9 | 9 | import * as IDEActions from '../modules/IDE/actions/ide'; |
10 | 10 | import * as toastActions from '../modules/IDE/actions/toast'; |
11 | 11 | import * as projectActions from '../modules/IDE/actions/project'; |
@@ -623,146 +623,18 @@ class Nav extends React.PureComponent { |
623 | 623 | /> |
624 | 624 | </button> |
625 | 625 | <ul className="nav__dropdown"> |
626 | | - <li className="nav__dropdown-item"> |
627 | | - <button |
628 | | - onFocus={this.handleFocusForLang} |
629 | | - onBlur={this.handleBlur} |
630 | | - value="de" |
631 | | - onClick={(e) => this.handleLangSelection(e)} |
632 | | - > |
633 | | - Deutsch |
634 | | - </button> |
635 | | - </li> |
636 | | - <li className="nav__dropdown-item"> |
637 | | - <button |
638 | | - onFocus={this.handleFocusForLang} |
639 | | - onBlur={this.handleBlur} |
640 | | - value="en-US" |
641 | | - onClick={(e) => this.handleLangSelection(e)} |
642 | | - > |
643 | | - English |
644 | | - </button> |
645 | | - </li> |
646 | | - <li className="nav__dropdown-item"> |
647 | | - <button |
648 | | - onFocus={this.handleFocusForLang} |
649 | | - onBlur={this.handleBlur} |
650 | | - value="es-419" |
651 | | - onClick={(e) => this.handleLangSelection(e)} |
652 | | - > |
653 | | - Español |
654 | | - </button> |
655 | | - </li> |
656 | | - <li className="nav__dropdown-item"> |
657 | | - <button |
658 | | - onFocus={this.handleFocusForLang} |
659 | | - onBlur={this.handleBlur} |
660 | | - value="fr-CA" |
661 | | - onClick={(e) => this.handleLangSelection(e)} |
662 | | - > |
663 | | - Français |
664 | | - </button> |
665 | | - </li> |
666 | | - <li className="nav__dropdown-item"> |
667 | | - <button |
668 | | - onFocus={this.handleFocusForLang} |
669 | | - onBlur={this.handleBlur} |
670 | | - value="hi" |
671 | | - onClick={(e) => this.handleLangSelection(e)} |
672 | | - > |
673 | | - हिन्दी |
674 | | - </button> |
675 | | - </li> |
676 | | - <li className="nav__dropdown-item"> |
677 | | - <button |
678 | | - onFocus={this.handleFocusForLang} |
679 | | - onBlur={this.handleBlur} |
680 | | - value="ko" |
681 | | - onClick={(e) => this.handleLangSelection(e)} |
682 | | - > |
683 | | - 한국어 |
684 | | - </button> |
685 | | - </li> |
686 | | - <li className="nav__dropdown-item"> |
687 | | - <button |
688 | | - onFocus={this.handleFocusForLang} |
689 | | - onBlur={this.handleBlur} |
690 | | - value="it" |
691 | | - onClick={(e) => this.handleLangSelection(e)} |
692 | | - > |
693 | | - Italiano |
694 | | - </button> |
695 | | - </li> |
696 | | - <li className="nav__dropdown-item"> |
697 | | - <button |
698 | | - onFocus={this.handleFocusForLang} |
699 | | - onBlur={this.handleBlur} |
700 | | - value="ja" |
701 | | - onClick={(e) => this.handleLangSelection(e)} |
702 | | - > |
703 | | - 日本語 |
704 | | - </button> |
705 | | - </li> |
706 | | - <li className="nav__dropdown-item"> |
707 | | - <button |
708 | | - onFocus={this.handleFocusForLang} |
709 | | - onBlur={this.handleBlur} |
710 | | - value="pt-BR" |
711 | | - onClick={(e) => this.handleLangSelection(e)} |
712 | | - > |
713 | | - Português |
714 | | - </button> |
715 | | - </li> |
716 | | - <li className="nav__dropdown-item"> |
717 | | - <button |
718 | | - onFocus={this.handleFocusForLang} |
719 | | - onBlur={this.handleBlur} |
720 | | - value="sv" |
721 | | - onClick={(e) => this.handleLangSelection(e)} |
722 | | - > |
723 | | - Svenska |
724 | | - </button> |
725 | | - </li> |
726 | | - <li className="nav__dropdown-item"> |
727 | | - <button |
728 | | - onFocus={this.handleFocusForLang} |
729 | | - onBlur={this.handleBlur} |
730 | | - value="uk-UA" |
731 | | - onClick={(e) => this.handleLangSelection(e)} |
732 | | - > |
733 | | - Українська |
734 | | - </button> |
735 | | - </li> |
736 | | - <li className="nav__dropdown-item"> |
737 | | - <button |
738 | | - onFocus={this.handleFocusForLang} |
739 | | - onBlur={this.handleBlur} |
740 | | - value="zh-CN" |
741 | | - onClick={(e) => this.handleLangSelection(e)} |
742 | | - > |
743 | | - 简体中文 |
744 | | - </button> |
745 | | - </li> |
746 | | - <li className="nav__dropdown-item"> |
747 | | - <button |
748 | | - onFocus={this.handleFocusForLang} |
749 | | - onBlur={this.handleBlur} |
750 | | - value="zh-TW" |
751 | | - onClick={(e) => this.handleLangSelection(e)} |
752 | | - > |
753 | | - 正體中文 |
754 | | - </button> |
755 | | - </li> |
756 | | - <li className="nav__dropdown-item"> |
757 | | - <button |
758 | | - onFocus={this.handleFocusForLang} |
759 | | - onBlur={this.handleBlur} |
760 | | - value="tr" |
761 | | - onClick={(e) => this.handleLangSelection(e)} |
762 | | - > |
763 | | - Türkçe |
764 | | - </button> |
765 | | - </li> |
| 626 | + {sortBy(availableLanguages).map((key) => ( |
| 627 | + <li className="nav__dropdown-item" key={key}> |
| 628 | + <button |
| 629 | + onFocus={this.handleFocusForLang} |
| 630 | + onBlur={this.handleBlur} |
| 631 | + value={key} |
| 632 | + onClick={this.handleLangSelection} |
| 633 | + > |
| 634 | + {languageKeyToLabel(key)} |
| 635 | + </button> |
| 636 | + </li> |
| 637 | + ))} |
766 | 638 | </ul> |
767 | 639 | </li> |
768 | 640 | </React.Fragment> |
|
0 commit comments