How to use the iso-639-1.getName 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.

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

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 dphiffer / firewall-cafe / server / index.js View on Github external
function getLanguageName(langCode) {
	if (ISO6391.validate(langCode)) {
		return ISO6391.getName(langCode);
	} else {
		var langInfo = BCP47.parse(langCode);
		if (ISO6391.validate(langInfo.language)) {
			var name = ISO6391.getName(langInfo.language);
			if (name == 'Chinese') {
				if (langInfo.region == 'CN') {
					name += ' (Simplified)';
				} else if (langInfo.region == 'TW') {
					name += ' (Traditional)';
				}
			}
			return name;
		} else {
			return langCode;
		}
	}
}
github slidewiki / slidewiki-platform / components / Deck / TranslationPanel / LanguagePanel.js View on Github external
renderAvailable(translation) {
        if (translation.language !== this.props.TranslationStore.currentLang.language){
            let languageName = ISO6391.getName(translation.language.toLowerCase().substr(0,2));
            if (languageName){
                return (
                    {value:translation.deck_id , text: languageName}
                );
            }else{
                return;
            }
        }else{
            return;
        }
    }
    render() {
github Alheimsins / bigfive-web / pages / index.js View on Github external
const languageList = languages.map(code => ({ code, name: ISO6391.getName(code) }))
github Coding-Coach / find-a-mentor / src / titleGenerator.js View on Github external
export function generate({ tag, country, name, language }) {
  let title = prefix;
  if (name || country || tag || language) {
    title += ' | ';

    if (name) {
      title += name;
    } else {
      if (language) {
        title += ` ${ISO6391.getName(language)} speaking `;
      }
      if (tag) {
        title += `${tag} `;
      }
      title += 'mentors';
      if (country) {
        title += ` from ${countries[country]}`;
      }
    }
  }
  return title;
}
github slidewiki / slidewiki-platform / components / webrtc / Translations.js View on Github external
openChooseLanguageModal() {

        let that = this;
        let tmp = {};
        ISO6391.getAllCodes().forEach((code) => {
            if(this.languages.includes(''+code))
                tmp[''+code] = '' + ISO6391.getName(code) + (((''+code) === that.deckLanguage) ? ' (default)' : '');
        });

        let dialog = {
            titleText: 'Choose your preferred language',
            html: '<p>Translations of this deck are available. You may choose one of these to view the slides in this langauge instead of the langauge the presenter chose to present (<strong>'+ISO6391.getName(this.deckLanguage)+'</strong>). You can change your decision at any time. Please keep in mind that not all slides might be translated to your chosen language.</p>',
            type: 'info',
            input: 'select',
            inputValue: this.chosenLanguage,
            inputOptions: tmp,
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: 'Okay',
            cancelButtonText: 'Cancel',
            allowOutsideClick: false,
            allowEscapeKey: false,
            preConfirm: function (lang) {
                return new Promise((resolve, reject) =&gt; {
                    that.changeLanguage(lang);
                    resolve();
                });
github slidewiki / slidewiki-platform / components / Deck / Translation / TranslationModal.js View on Github external
available_array = translations.map((translation) =&gt; {
                let languageName = ISO6391.getName(translation.language.toLowerCase().substr(0,2));
                let link = '/deck/';
                if (languageName){
                    if (translation.language !== currentLanguage){
                        switch (mode){
                            case 'deck':
                                link+= translation.deck_id;
                                return (
                                    <a href="{link}">{languageName}, </a>
                                );
                                break;
                            case 'slide':
                                return (
                                    <a>{languageName}, </a>
                                );
                                break;
                            case 'subdeck':
github dphiffer / firewall-cafe / server / index.js View on Github external
function getLanguageName(langCode) {
	if (ISO6391.validate(langCode)) {
		return ISO6391.getName(langCode);
	} else {
		var langInfo = BCP47.parse(langCode);
		if (ISO6391.validate(langInfo.language)) {
			var name = ISO6391.getName(langInfo.language);
			if (name == 'Chinese') {
				if (langInfo.region == 'CN') {
					name += ' (Simplified)';
				} else if (langInfo.region == 'TW') {
					name += ' (Traditional)';
				}
			}
			return name;
		} else {
			return langCode;
		}
	}