How to use the iso-639-1.getLanguages 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 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 Coding-Coach / find-a-mentor / src / components / MemberArea / model.js View on Github external
import React from 'react';
import ISO6391 from 'iso-639-1';
import countries from 'svg-country-flags/countries.json';
import tags from './tags';

const languages = ISO6391.getLanguages(ISO6391.getAllCodes());
const emailPattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
const urlPattern = /^https:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)$/;
const linkedinPattern = /^[A-Za-z0-9-]{3,100}$/;
const facebookPattern = /^[a-z\d.]{5,50}$/i;
const twitterPattern = /^[A-Za-z0-9_]{1,15}$/;
const githubPattern = /^([a-z\d]+-)*[a-z\d]+$/i;

const emailValidation = value => !value || emailPattern.test(value);
const urlValidation = value => !value || urlPattern.test(value);
const linkedinValidation = value => !value || linkedinPattern.test(value);
const facebookValidation = value => !value || facebookPattern.test(value);
const twitterValidation = value => !value || twitterPattern.test(value);
const githubValidation = value => !value || githubPattern.test(value);
const nameValidation = value =>
  value.length > 3 && value.length <= 50 && /^\S+(\s\S+)+$/.test(value);
github Common-Voice / sentence-collector / shared / languages.js View on Github external
export const getAllLanguages = () => {
  const isoLanguages = ISO6391.getLanguages(ISO6391.getAllCodes());
  const languagesWithoutRemoved = removeLanguages(isoLanguages);
  const allLanguages = addAdditionalLanguages(languagesWithoutRemoved);
  const allLanguagesSorted = allLanguages.sort((a, b) => {
    if (a.name < b.name) return -1;
    if (a.name > b.name) return 1;
    return 0;
  });
  return allLanguagesSorted;
};