Some fixes.

- Use ISO-630 library for native language names
- Add sr-only to svg tooltips. Fixes #218
- Change support link and icon.
This commit is contained in:
Dessalines 2021-03-25 11:20:54 -04:00
parent bd7e22d196
commit b830c0f60e
6 changed files with 49 additions and 39 deletions

View file

@ -67,6 +67,7 @@
"eslint": "^7.20.0", "eslint": "^7.20.0",
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.3.1",
"husky": "^5.1.0", "husky": "^5.1.0",
"iso-639-1": "^2.1.9",
"lemmy-js-client": "0.10.0-rc.10", "lemmy-js-client": "0.10.0-rc.10",
"lint-staged": "^10.5.4", "lint-staged": "^10.5.4",
"mini-css-extract-plugin": "^1.3.8", "mini-css-extract-plugin": "^1.3.8",

View file

@ -13,7 +13,9 @@ export class Icon extends Component<IconProps, any> {
render() { render() {
return ( return (
<svg class={`icon ${this.props.classes}`}> <svg class={`icon ${this.props.classes}`}>
<div class="sr-only">
<title>{this.props.icon}</title> <title>{this.props.icon}</title>
</div>
<use xlinkHref={`#icon-${this.props.icon}`}></use> <use xlinkHref={`#icon-${this.props.icon}`}></use>
</svg> </svg>
); );

View file

@ -262,7 +262,7 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
title={i18n.t("support_lemmy")} title={i18n.t("support_lemmy")}
href={supportLemmyUrl} href={supportLemmyUrl}
> >
<Icon icon="beer" classes="small" /> <Icon icon="heart" classes="small" />
</a> </a>
</li> </li>
</ul> </ul>

View file

@ -1,6 +1,7 @@
import { Component, linkEvent } from "inferno"; import { Component, linkEvent } from "inferno";
import { Link } from "inferno-router"; import { Link } from "inferno-router";
import { Subscription } from "rxjs"; import { Subscription } from "rxjs";
import ISO6391 from "iso-639-1";
import { import {
UserOperation, UserOperation,
SortType, SortType,
@ -536,8 +537,10 @@ export class Person extends Component<any, PersonState> {
<option disabled aria-hidden="true"> <option disabled aria-hidden="true">
</option> </option>
{languages.map(lang => ( {languages.sort().map(lang => (
<option value={lang.code}>{lang.name}</option> <option value={lang.code}>
{ISO6391.getNativeName(lang.code) || lang.code}
</option>
))} ))}
</select> </select>
</div> </div>

View file

@ -78,7 +78,7 @@ export const favIconPngUrl = "/static/assets/apple-touch-icon.png";
// export const defaultFavIcon = `${window.location.protocol}//${window.location.host}${favIconPngUrl}`; // export const defaultFavIcon = `${window.location.protocol}//${window.location.host}${favIconPngUrl}`;
export const repoUrl = "https://github.com/LemmyNet"; export const repoUrl = "https://github.com/LemmyNet";
export const joinLemmyUrl = "https://join.lemmy.ml"; export const joinLemmyUrl = "https://join.lemmy.ml";
export const supportLemmyUrl = "https://join.lemmy.ml/sponsors"; export const supportLemmyUrl = "https://join.lemmy.ml/support";
export const docsUrl = "https://join.lemmy.ml/docs/en/index.html"; export const docsUrl = "https://join.lemmy.ml/docs/en/index.html";
export const helpGuideUrl = "https://join.lemmy.ml/docs/en/about/guide.html"; // TODO find a way to redirect to the non-en folder export const helpGuideUrl = "https://join.lemmy.ml/docs/en/about/guide.html"; // TODO find a way to redirect to the non-en folder
export const markdownHelpUrl = `${helpGuideUrl}#markdown-guide`; export const markdownHelpUrl = `${helpGuideUrl}#markdown-guide`;
@ -91,39 +91,39 @@ export const fetchLimit = 20;
export const mentionDropdownFetchLimit = 10; export const mentionDropdownFetchLimit = 10;
export const languages = [ export const languages = [
{ code: "ca", name: "Català" }, { code: "ca" },
{ code: "en", name: "English" }, { code: "en" },
{ code: "el", name: "Ελληνικά" }, { code: "el" },
{ code: "eu", name: "Euskara" }, { code: "eu" },
{ code: "eo", name: "Esperanto" }, { code: "eo" },
{ code: "es", name: "Español" }, { code: "es" },
{ code: "da", name: "Dansk" }, { code: "da" },
{ code: "de", name: "Deutsch" }, { code: "de" },
{ code: "ga", name: "Gaeilge" }, { code: "ga" },
{ code: "gl", name: "Galego" }, { code: "gl" },
{ code: "hr", name: "hrvatski" }, { code: "hr" },
{ code: "hu", name: "Magyar Nyelv" }, { code: "hu" },
{ code: "ka", name: "ქართული ენა" }, { code: "ka" },
{ code: "ko", name: "한국어" }, { code: "ko" },
{ code: "km", name: "ភាសាខ្មែរ" }, { code: "km" },
{ code: "hi", name: "मानक हिन्दी" }, { code: "hi" },
{ code: "fa", name: "فارسی" }, { code: "fa" },
{ code: "ja", name: "日本語" }, { code: "ja" },
{ code: "oc", name: "Occitan" }, { code: "oc" },
{ code: "pl", name: "Polski" }, { code: "pl" },
{ code: "pt_BR", name: "Português Brasileiro" }, { code: "pt_BR" },
{ code: "zh", name: "中文" }, { code: "zh" },
{ code: "fi", name: "Suomi" }, { code: "fi" },
{ code: "fr", name: "Français" }, { code: "fr" },
{ code: "sv", name: "Svenska" }, { code: "sv" },
{ code: "sq", name: "Shqip" }, { code: "sq" },
{ code: "sr_Latn", name: "srpski" }, { code: "sr_Latn" },
{ code: "th", name: "ภาษาไทย" }, { code: "th" },
{ code: "tr", name: "Türkçe" }, { code: "tr" },
{ code: "uk", name: "Українська Mова" }, { code: "uk" },
{ code: "ru", name: "Русский" }, { code: "ru" },
{ code: "nl", name: "Nederlands" }, { code: "nl" },
{ code: "it", name: "Italiano" }, { code: "it" },
]; ];
export const themes = [ export const themes = [
@ -381,7 +381,6 @@ export function getLanguage(override?: string): string {
} }
} }
// TODO
export function getBrowserLanguage(): string { export function getBrowserLanguage(): string {
return navigator.language; return navigator.language;
} }

View file

@ -4833,6 +4833,11 @@ isexe@^2.0.0:
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
iso-639-1@^2.1.9:
version "2.1.9"
resolved "https://registry.yarnpkg.com/iso-639-1/-/iso-639-1-2.1.9.tgz#e41b11d4f1808e5316d0252c3fa16eeb9b37bb58"
integrity sha512-owRu9up+Cpx/hwSzm83j6G8PtC7U99UCtPVItsafefNfEgMl+pi8KBwhXwJkJfp6IouyYWFxj8n24SvCWpKZEQ==
isobject@^2.0.0: isobject@^2.0.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89"