Ver código fonte

docs: better header maybe?

Sv443 4 meses atrás
pai
commit
90c1817f78
3 arquivos alterados com 15 adições e 13 exclusões
  1. 3 3
      README-summary.md
  2. 3 3
      README.md
  3. 9 7
      src/tools/gen-readme.ts

+ 3 - 3
README-summary.md

@@ -4,10 +4,10 @@
 
 ### Lots of configurable layout and user experience improvements for YouTube Music™ and YouTube™
 
-#### [**Features**](#features) • [**Installation**](#installation) • [**Integrations**](#integrations) • [**Plugins**](#plugins) • [**Support**](#support) • [**Development**](#development) • [**Attributions**](#attributions) • [**Disclaimers**](#disclaimers)
----
+<h4>Available in these languages: <abbr title="Chinese (Simplified, China)">🇨🇳&nbsp;CN</abbr>, <abbr title="English (Great Britain)">🇬🇧&nbsp;GB</abbr>, <abbr title="English (United States)">🇺🇸&nbsp;US</abbr>, <abbr title="French (France)">🇫🇷&nbsp;FR</abbr>, <abbr title="German (Germany)">🇩🇪&nbsp;DE</abbr>, <abbr title="Hindi (India)">🇮🇳&nbsp;IN</abbr>, <abbr title="Japanese (Japan)">🇯🇵&nbsp;JP</abbr>, <abbr title="Portuguese (Brazil)">🇧🇷&nbsp;BR</abbr>, <abbr title="Spanish (Spain)">🇪🇸&nbsp;ES</abbr></h4>
 
-Available in 🇨🇳&nbsp;Chinese (simpl.), 🇬🇧&nbsp;English (GB), 🇺🇸&nbsp;English (US), 🇫🇷&nbsp;French (FR), 🇩🇪&nbsp;German (DE), 🇮🇳&nbsp;Hindi (IN), 🇯🇵&nbsp;Japanese (JP), 🇧🇷&nbsp;Portuguese (BR), 🇪🇸&nbsp;Spanish (ES)
+---
+#### [**Features**](#features) • [**Installation**](#installation) • [**Integrations**](#integrations) • [**Plugins**](#plugins) • [**Support**](#support) • [**Development**](#development) • [**Attributions**](#attributions) • [**Disclaimers**](#disclaimers)
 <!-- END OF GENERATED CONTENT -->
 <!-- </{{HEADER}}> -->
 

+ 3 - 3
README.md

@@ -5,10 +5,10 @@
 
 ### Lots of configurable layout and user experience improvements for YouTube Music™ and YouTube™
 
-#### [**Features**](#features) • [**Installation**](#installation) • [**Integrations**](#integrations) • [**Plugins**](#plugins) • [**Support**](#support) • [**Development**](#development) • [**Attributions**](#attributions) • [**Disclaimers**](#disclaimers)
----
+<h4>Available in these languages: <abbr title="Chinese (Simplified, China)">🇨🇳&nbsp;CN</abbr>, <abbr title="English (Great Britain)">🇬🇧&nbsp;GB</abbr>, <abbr title="English (United States)">🇺🇸&nbsp;US</abbr>, <abbr title="French (France)">🇫🇷&nbsp;FR</abbr>, <abbr title="German (Germany)">🇩🇪&nbsp;DE</abbr>, <abbr title="Hindi (India)">🇮🇳&nbsp;IN</abbr>, <abbr title="Japanese (Japan)">🇯🇵&nbsp;JP</abbr>, <abbr title="Portuguese (Brazil)">🇧🇷&nbsp;BR</abbr>, <abbr title="Spanish (Spain)">🇪🇸&nbsp;ES</abbr></h4>
 
-Available in 🇨🇳&nbsp;Chinese (simpl.), 🇬🇧&nbsp;English (GB), 🇺🇸&nbsp;English (US), 🇫🇷&nbsp;French (FR), 🇩🇪&nbsp;German (DE), 🇮🇳&nbsp;Hindi (IN), 🇯🇵&nbsp;Japanese (JP), 🇧🇷&nbsp;Portuguese (BR), 🇪🇸&nbsp;Spanish (ES)
+---
+#### [**Features**](#features) • [**Installation**](#installation) • [**Integrations**](#integrations) • [**Plugins**](#plugins) • [**Support**](#support) • [**Development**](#development) • [**Attributions**](#attributions) • [**Disclaimers**](#disclaimers)
 <!-- END OF GENERATED CONTENT -->
 <!-- </{{HEADER}}> -->
 

+ 9 - 7
src/tools/gen-readme.ts

@@ -87,10 +87,11 @@ async function modifyReadme(readmeLines: string[], changes: Record<string, () =>
 }
 
 async function genHeader() {
-  const langStr = [ ...Object.values(locales) ]
-    .sort((a, b) => a.nameEnglish.localeCompare(b.nameEnglish))
-    .reduce((acc, { nameEnglish, emoji }, i) => {
-      return `${acc}${i > 0 ? ", " : ""}${emoji}&nbsp;${nameEnglish}`;
+  const langStr = [ ...Object.entries(locales) ]
+    .sort(([, a], [, b]) => a.nameEnglish.localeCompare(b.nameEnglish))
+    .reduce((acc, [locale, { emoji, nameEnglish }], i) => {
+      const countryCode = locale.split("-")[1];
+      return `${acc}${i > 0 ? ", " : ""}<abbr title="${nameEnglish}">${emoji}&nbsp;${countryCode}</abbr>`;
     }, "");
 
   return `\
@@ -98,10 +99,11 @@ async function genHeader() {
 
 ### ${pkgJson.description}
 
-#### [**Features**](#features) • [**Installation**](#installation) • [**Integrations**](#integrations) • [**Plugins**](#plugins) • [**Support**](#support) • [**Development**](#development) • [**Attributions**](#attributions) • [**Disclaimers**](#disclaimers)
----
+<h4>Available in these languages: ${langStr}</h4>
 
-Available in ${langStr}`;
+---
+#### [**Features**](#features) • [**Installation**](#installation) • [**Integrations**](#integrations) • [**Plugins**](#plugins) • [**Support**](#support) • [**Development**](#development) • [**Attributions**](#attributions) • [**Disclaimers**](#disclaimers)\
+`;
 }
 
 async function genPluginList() {