How to use the iso-639-1.getNativeName function in iso-639-1

To help you get started, we’ve selected a few iso-639-1 examples, based on popular ways it is used in public projects.

github fossasia / susi_skill_cms / src / components / SkillEditor / SkillEditor.js View on Github external
success: function(data) {
          data = data.languagesArray;
          this.setState({ languages: data });
          // console.log(data);
          for (let i = 0; i < data.length; i++) {
            if (ISO6391.getNativeName(data[i])) {
              languages.push(
                <MenuItem
                  value={data[i]}
                  key={data[i]}
                  primaryText={ISO6391.getNativeName(data[i])}
                />,
              );
            } else {
              languages.push(
                <MenuItem
                  value={data[i]}
                  key={data[i]}
                  primaryText={'Universal'}
                />,
              );
            }
          }
        }.bind(this),
        error: function(e) {
github openmultiplayer / web / frontend / scripts / gentree.js View on Github external
return parseDir(filename + "/" + child);
        })
        .filter((v) => v !== null);
    }
    // it's a directory inside `docs` folder
    else {
      info.type = "category";
      let catName = path.basename(filename);

      if (catName[0] == "_") {
        catName = catName.substring(1);
      }
      catName = catName.replace("_", " ");

      if (catName.length == 2) {
        catName = ISO6391.getNativeName(catName);
      } else if (catName.length == 5) {
        // Taiwan uses Traditional Chinese as its script, we're using ISO codes
        // for countries not languages, so this slight modification is for that.
        if (catName == "zh-tw") {
          catName = "繁體中文";
        } else if (catName == "zh-cn") {
          catName = "简体中文";
        }
      }

      if (CATEGORY_NAME_CAPITALIZATION) {
        info.label = catName.charAt(0).toUpperCase() + catName.substring(1);
      } else {
        info.label = catName;
      }
github fossasia / susi_skill_cms / src / components / BrowseSkill / BrowseSkillByLanguage.js View on Github external
componentDidMount() {
    document.title = `SUSI.AI - ${ISO6391.getNativeName(
      this.props.location.pathname.split('/')[2],
    )} Skills`;
  }
  render() {
github fossasia / susi_skill_cms / src / components / AuthorSkills / AuthorSkills.js View on Github external
<Img
                style={imageStyle}
                src={[pngImage, jpgImage]}
                unloader={<CircleImage name={name} size="40" />}
              />
            </a>
          </TableRowColumn>
          <TableRowColumn>
            <div>
              <a href={skillURL} className="effect-underline">
                {name}
              </a>
            </div>
          </TableRowColumn>
          <TableRowColumn>{category}</TableRowColumn>
          <TableRowColumn>{ISO6391.getNativeName(language)}</TableRowColumn>
        </TableRow>
      );
    });
    return skills;
github fossasia / susi.ai / src / components / cms / SkillPage / SkillListing.js View on Github external
<Title>Skill Details</Title>
            <table>
              <tbody>
                <tr>
                  <td>Category: </td>
                  <td>
                    <Link to={`/category/${this.groupValue}`}>
                      {this.groupValue}
                    </Link>
                  </td>
                </tr>
                <tr>
                  <td>Language: </td>
                  <td>
                    <Link to={`/language/${this.languageValue}`}>
                      {ISO6391.getNativeName(this.languageValue)}
                    </Link>
                  </td>
                </tr>
                <tr>
                  <td>Updated on: </td>
                  <td>{` ${parseDate(lastModifiedTime)}`}</td>
                </tr>
                <tr>
                  <td>Languages supported:</td>
                  <td>
                    {supportedLanguages.map((data, index) => {
                      const delimiter =
                        supportedLanguages.length === index + 1 ? null : ', ';
                      return (
                        <Link
                          key={index}
github fossasia / susi_skill_cms / src / components / BrowseSkill / BrowseSkill.js View on Github external
return this.props.languages.map(name => (
      <MenuItem
        key={name}
        checked={values && values.indexOf(name) > -1}
        value={name}
      >
        {ISO6391.getNativeName(name)
          ? ISO6391.getNativeName(name)
          : 'Universal'}
      </MenuItem>
    ));
  };
github fossasia / susi.ai / src / components / cms / AuthorSkills / AuthorSkills.js View on Github external
<TableRow key={index}>
          <TableCell>
            <a href={skillURL}>
              <Image
                src={[pngImage, jpgImage]}
                unloader={<CircleImage name={name} size="40" />}
              />
            </a>
          </TableCell>
          <TableCell>
            <UnderlineLink href={skillURL}>{name}</UnderlineLink>
          </TableCell>
          <TableCell>
            <UnderlineLink href={categoryURL}>{category}</UnderlineLink>
          </TableCell>
          <TableCell>{ISO6391.getNativeName(language)}</TableCell>
        </TableRow>
      );
    });
    return skills;
github fossasia / susi.ai / src / components / cms / SkillPage / SkillListing.js View on Github external
{supportedLanguages.map((data, index) => {
                      const delimiter =
                        supportedLanguages.length === index + 1 ? null : ', ';
                      return (
                        <Link
                          key={index}
                          onClick={this.forceUpdate}
                          to={`/${this.groupValue}/${data.name}/${data.language}`}
                        >
                          {ISO6391.getNativeName(data.language)}
                          {delimiter}
                        </Link>
                      );
                    })}
                  </td>
github fossasia / susi_skill_cms / src / components / SkillCreator / SkillCreator.js View on Github external
.then(payload => {
          const data = payload.languagesArray;
          this.setState({ languages: data });
          for (let i = 0; i < data.length; i++) {
            if (ISO6391.getNativeName(data[i])) {
              languages.push(
                <MenuItem value={data[i]} key={data[i]}>
                  {ISO6391.getNativeName(data[i])}
                </MenuItem>,
              );
            } else {
              languages.push(
                <MenuItem value={data[i]} key={data[i]}>
                  Universal
                </MenuItem>,
              );
            }
            if (data[i] === 'en') {
              this.handleLanguageChange(null, 0, 'en');
              this.setState({ languageSelect: false, expertSelect: false });
            }
          }
          languages.sort(function(a, b) {
            if (a.props.primaryText < b.props.primaryText) {
github openmultiplayer / web / frontend / src / utils / getLanguageName.ts View on Github external
const getLanguageName = (short: string) =>
  ISO6391.getNativeName(short) || missingLanguages?.[short] || short;