Fix pt-br returning () (#716)

* Fix pt-br returning ()

* Replace ISO-639-1 with Intl.DisplayNames
This commit is contained in:
Andreas 2021-08-05 04:09:57 +02:00 committed by GitHub
parent 8330219459
commit 45b2583efd
3 changed files with 17 additions and 24 deletions

25
package-lock.json generated
View File

@ -13,7 +13,6 @@
"axios": "^0.21.1",
"core-js": "2.6.4",
"element-ui": "^2.15.3",
"iso-639-1": "^2.1.9",
"lodash.groupby": "^4.6.0",
"lodash.sortby": "^4.7.0",
"marked": "^2.1.3",
@ -2137,6 +2136,8 @@
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.16.0.tgz",
"integrity": "sha512-5+5VxRFmSf97nM8Jr2wzOwLqRo6zphH2aX+7KsAUONObyzakDNq2G/bgbhinxB4PoV9L3aXQYhiDKyIKWd2c8g==",
"hasInstallScript": true,
"optional": true,
"peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/core-js"
@ -9692,14 +9693,6 @@
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
},
"node_modules/iso-639-1": {
"version": "2.1.9",
"resolved": "https://registry.npmjs.org/iso-639-1/-/iso-639-1-2.1.9.tgz",
"integrity": "sha512-owRu9up+Cpx/hwSzm83j6G8PtC7U99UCtPVItsafefNfEgMl+pi8KBwhXwJkJfp6IouyYWFxj8n24SvCWpKZEQ==",
"engines": {
"node": ">=6.0"
}
},
"node_modules/isobject": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
@ -18883,7 +18876,6 @@
"resolved": "https://registry.npmjs.org/@vue/babel-preset-app/-/babel-preset-app-4.5.13.tgz",
"integrity": "sha512-pM7CR3yXB6L8Gfn6EmX7FLNE3+V/15I3o33GkSNsWvgsMp6HVGXKkXgojrcfUUauyL1LZOdvTmu4enU2RePGHw==",
"requires": {
"@babel/core": "^7.11.0",
"@babel/helper-compilation-targets": "^7.9.6",
"@babel/helper-module-imports": "^7.8.3",
"@babel/plugin-proposal-class-properties": "^7.8.3",
@ -18896,15 +18888,15 @@
"@vue/babel-plugin-jsx": "^1.0.3",
"@vue/babel-preset-jsx": "^1.2.4",
"babel-plugin-dynamic-import-node": "^2.3.3",
"core-js": "^3.6.5",
"core-js-compat": "^3.6.5",
"semver": "^6.1.0"
},
"dependencies": {
"core-js": {
"version": "3.16.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.16.0.tgz",
"integrity": "sha512-5+5VxRFmSf97nM8Jr2wzOwLqRo6zphH2aX+7KsAUONObyzakDNq2G/bgbhinxB4PoV9L3aXQYhiDKyIKWd2c8g=="
"version": "https://registry.npmjs.org/core-js/-/core-js-3.16.0.tgz",
"integrity": "sha512-5+5VxRFmSf97nM8Jr2wzOwLqRo6zphH2aX+7KsAUONObyzakDNq2G/bgbhinxB4PoV9L3aXQYhiDKyIKWd2c8g==",
"optional": true,
"peer": true
}
}
},
@ -24821,11 +24813,6 @@
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
},
"iso-639-1": {
"version": "2.1.9",
"resolved": "https://registry.npmjs.org/iso-639-1/-/iso-639-1-2.1.9.tgz",
"integrity": "sha512-owRu9up+Cpx/hwSzm83j6G8PtC7U99UCtPVItsafefNfEgMl+pi8KBwhXwJkJfp6IouyYWFxj8n24SvCWpKZEQ=="
},
"isobject": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",

View File

@ -45,7 +45,6 @@
"axios": "^0.21.1",
"core-js": "2.6.4",
"element-ui": "^2.15.3",
"iso-639-1": "^2.1.9",
"lodash.groupby": "^4.6.0",
"lodash.sortby": "^4.7.0",
"marked": "^2.1.3",

View File

@ -1,9 +1,16 @@
import ISO6391 from "iso-639-1";
export function simpleLangName(code) {
return code === "all" ? "All" : ISO6391.getName(code);
if (code === "all") {
return "All";
}
const namesInEnglish = new Intl.DisplayNames(["en"], { type: "language" });
return namesInEnglish.of(code);
}
export function langName(code) {
return code === "all" ? "All" : `${ISO6391.getName(code)} (${ISO6391.getNativeName(code)})`;
if (code === "all") {
return "All";
}
const namesInEnglish = new Intl.DisplayNames(["en"], { type: "language" });
const namesInNative = new Intl.DisplayNames([code], { type: "language" });
return `${namesInEnglish.of(code)} - ${namesInNative.of(code)}`;
}