How to use iso-639-1 - 10 common examples

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

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

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]}">,
              );
            } else {
              languages.push(
                <menuitem value="{data[i]}">,
              );
            }
          }
        }.bind(this),
        error: function(e) {</menuitem></menuitem>
github webtorrent / webtorrent-desktop / src / renderer / controllers / subtitles-controller.js View on Github external
function isSystemLanguage (language) {
  const iso639 = require('iso-639-1')
  const osLangISO = window.navigator.language.split('-')[0] // eg 'en'
  const langIso = iso639.getCode(language) // eg 'de' if language is 'German'
  return langIso === osLangISO
}
github turt2live / matrix-dimension / web / app / admin / terms / new-edit / new-edit.component.ts View on Github external
public addLanguage() {
        this.languages[this.chosenLanguage] = {
            name: "",
            text: "",
            url: "", // TODO: Calculate
            isExternal: false,
            externalUrl: "",
            langName: ISO6391.getName(this.chosenLanguage),
        };
        this.chosenLanguage = this.availableLanguages[0].code;
    }
github Coding-Coach / find-a-mentor-api / src / modules / common / schemas / user.schema.ts View on Github external
languages.sort().forEach(id => {
    // @ts-ignore
    const label: string = languagesDb.getName(id);

    if (label) {
      result.push(new FilterDto({ id, label }));
    }
  });
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 paulrobertlloyd / indiekit / packages / app / index.js View on Github external
app.use(async (req, res, next) => {
  res.locals.app = await application.getAll();
  res.locals.app.url = `${req.protocol}://${req.headers.host}`;
  // res.locals.github = await publisher('github').getAll();
  // res.locals.gitlab = await publisher('gitlab').getAll();
  res.locals.pub = await publication.getAll();
  res.locals.session = req.session;
  res.locals.timezones = timezones;
  res.locals.languages = languages.getLanguages(languages.getAllCodes());

  next();
});
github turt2live / matrix-dimension / web / app / admin / terms / new-edit / new-edit.component.ts View on Github external
templateUrl: "./new-edit.component.html",
    styleUrls: ["./new-edit.component.scss"],
})
export class AdminNewEditTermsComponent implements OnInit {

    // TODO: Multiple language support
    // TODO: Support external URLs

    private shortcode: string;

    public Editor = ClassicEditor;

    public isLoading = true;
    public isUpdating = false;
    public takenShortcodes: string[];
    public chosenLanguage: string = ISO6391.getAllCodes()[0];
    public languages: {
        [languageCode: string]: ILanguage;
    } = {
        "en": {
            name: "",
            text: "",
            langName: "English",
            url: "", // TODO: Calculate
            isExternal: false,
            externalUrl: "",
        },
    };
    public isEditing = false;

    public get chosenLanguageCodes(): string[] {
        return Object.keys(this.languages);
github galnir / Master-Bot / commands / other / translate.js View on Github external
async run(message, { targetLang }) {
    const langCode = ISO6391.getCode(targetLang);
    if (langCode === '')
      return message.channel.send('Please provide a valid language!');

    // text needs to be less than 3000 length

    await message.channel.send(
      `Please enter the text you want to translate to ${targetLang}`
    );

    try {
      const filter = msg =&gt; msg.content.length &gt; 0 &amp;&amp; msg.content.length &lt; 3000;
      var response = await message.channel.awaitMessages(filter, {
        max: 1,
        maxProcessed: 1,
        time: 90000,
        errors: ['time']
github xyfir / illuminsight / components / Edit.tsx View on Github external
function onAddLanguage(): void {
    const code = ISO6391.getCode(language);
    if (!code) return;

    // Add language to pub
    if (!pub!.languages.includes(code)) pub!.languages.push(code);

    setPub(pub);
  }
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() {