iso-639-1 - npm

文章推薦指數: 80 %
投票人數:10人

Keywords. iso · iso-639 · iso-639-1 · language · language code · locale · locale code. Install. npm i iso-639-1. Repository. iso-639-12.1.11 • Public • Published17daysagoReadmeExploreBETA0Dependencies121Dependents31Versions ISO-639-1 SimpleinterfaceforISO-639-1languagecodes Installation npminstalliso-639-1 Usage Node.js constISO6391=require('iso-639-1'); console.log(ISO6391.getName('en'));//'English' ESModule importISO6391from'iso-639-1'; console.log(ISO6391.getName('en'));//'English' Browsers HTML VisitglobalvariableISO6391injs console.log(ISO6391.getName('en'));//'English' Methods getName(code) @paramcode{string} @return{string} Lookuplanguageenglishnamebycode getAllNames() @return{array} Getarrayofalllanguageenglishnames getNativeName(code) @paramcode{string} @return{string} Lookuplanguagenativenamebycode getAllNativeNames() @return{array} Getarrayofalllanguagenativenames getCode(name) @paramname{string} @return{string} Lookupcodebyenglishnameornativename getAllCodes() @return{array} Getarrayofallcodes validate(code) @paramcode{string} @return{boolean} CheckwhetherthegivencodeisinthelistofISO-639-1 getLanguages(codes) @paramcodes{array} @return{array} Getthearrayofthelanguageobjectsbythegivencodes Example constISO6391=require('iso-639-1') console.log(ISO6391.getName('zh'))//'Chinese' console.log(ISO6391.getNativeName('zh'))//'中文' console.log(ISO6391.getAllNames())//['Afar','Abkhaz',...,'Zulu'] console.log(ISO6391.getAllNativeNames())//['Afaraf','аҧсуабызшәа',...,'isiZulu'] console.log(ISO6391.getCode('Chinese'))//'zh' console.log(ISO6391.getCode('中文'))//'zh' console.log(ISO6391.getAllCodes())//['aa','ab',...,'zu'] console.log(ISO6391.validate('en'))//true console.log(ISO6391.validate('xx'))//false console.log(ISO6391.getLanguages(['en','zh'])) //[{code:'en',name:'English',nativeName:'English'},{code:'zh',name:'Chinese',nativeName:'中文'}] Keywordsisoiso-639iso-639-1languagelanguagecodelocalelocalecodeInstallnpmiiso-639-1RepositoryGitgithub.com/meikidd/iso-639-1Homepagegithub.com/meikidd/iso-639-1#readmeDownloadsWeeklyDownloads58,679Version2.1.11LicenseMITUnpackedSize224kBTotalFiles16Lastpublish17daysagoCollaboratorsTryonRunKitReportmalware



請為這篇文章評分?