Repository: anuraghazra/github-readme-stats
Pull request #2832 (2023-06-16 04:06:05)

Top langs card: Increase maximum languages count to 20
Related to #1651

vercel[bot]: [vc]: #1WafVrkN+VsUMmWwJAd+XbgRt+g6Tz36TbZslLUAId8=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJnaXRodWItcmVhZG1lLXN0YXRzIiwiaW5zcGVjdG9yVXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL2dpdGh1Yi1yZWFkbWUtc3RhdHMtdGVhbS9naXRodWItcmVhZG1lLXN0YXRzL0JiOWFUOTQ5bVJHd2ZlQ2JueTJuQXR1ZnhWMzMiLCJwcmV2aWV3VXJsIjoiZ2l0aHViLXJlYWRtZS1zdGF0cy1naXQtdG9wbGFuZy03ZGFmNDctZ2l0aHViLXJlYWRtZS1zdGF0cy10ZWFtLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQifV19
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Updated (UTC) |
| :--- | :----- | :------ | :------ |
| **github-readme-stats** | ✅ Ready ([Inspect](https://vercel.com/github-readme-stats-team/github-readme-stats/Bb9aT949mRGwfeCbny2nAtufxV33)) | [Visit Preview](https://github-readme-stats-git-toplang-7daf47-github-readme-stats-team.vercel.app) | Jun 16, 2023 4:06am |


codecov[bot]: ## [Codecov](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/2832?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) Report
Patch coverage: **`100.00`**% and no project coverage change.
> Comparison is base [(`22a12e1`)](https://app.codecov.io/gh/anuraghazra/github-readme-stats/commit/22a12e1adeeeab9010b242f953f02a83a0772dd5?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) 97.61% compared to head [(`70ccc28`)](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/2832?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) 97.61%.

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##           master    #2832   +/-   ##
=======================================
  Coverage   97.61%   97.61%           
=======================================
  Files          24       24           
  Lines        4871     4872    +1     
  Branches      449      449           
=======================================
+ Hits         4755     4756    +1     
  Misses        115      115           
  Partials        1        1           
```


| [Impacted Files](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/2832?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) | Coverage Δ | |
|---|---|---|
| [src/cards/top-languages-card.js](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/2832?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra#diff-c3JjL2NhcmRzL3RvcC1sYW5ndWFnZXMtY2FyZC5qcw==) | `100.00% <100.00%> (ø)` | |


</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/2832?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra).


Patch:
diff --git a/readme.md b/readme.md
index 4e4de58..0e843a8 100644
--- a/readme.md
+++ b/readme.md
@@ -235,15 +235,15 @@ You can use [GitHub's new media feature](https://github.blog/changelog/2022-05-1
 
 ```html
 <picture>
-<source
-  srcset="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=dark"
-  media="(prefers-color-scheme: dark)"
-/>
-<source
-  srcset="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true"
-  media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
-/>
-<img src="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true" />
+  <source
+    srcset="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=dark"
+    media="(prefers-color-scheme: dark)"
+  />
+  <source
+    srcset="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true"
+    media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
+  />
+  <img src="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true" />
 </picture>
 ```
 
@@ -635,7 +635,7 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme
 ## On other platforms
 
 > **Warning**
-> This way of using GRS is not officially supported and was added to cater to some particular use cases where Vercel could not be used (e.g. #2341). The support for this method, therefore, is limited.
+> This way of using GRS is not officially supported and was added to cater to some particular use cases where Vercel could not be used (e.g. [#2341](https://github.com/anuraghazra/github-readme-stats/discussions/2341)). The support for this method, therefore, is limited.
 
 <details>
 <summary><b>:hammer_and_wrench: Step-by-step guide for deploying on other platforms</b></summary>
diff --git a/src/cards/stats-card.js b/src/cards/stats-card.js
index 30f85f7..9b5763e 100644
--- a/src/cards/stats-card.js
+++ b/src/cards/stats-card.js
@@ -160,6 +160,16 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
     value: totalPRs,
     id: "prs",
   };
+
+  if (show_total_reviews) {
+    STATS.reviews = {
+      icon: icons.reviews,
+      label: i18n.t("statcard.reviews"),
+      value: totalReviews,
+      id: "reviews",
+    };
+  }
+
   STATS.issues = {
     icon: icons.issues,
     label: i18n.t("statcard.issues"),
@@ -173,16 +183,6 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
     id: "contribs",
   };
 
-  // Extra stats items.
-  if (show_total_reviews) {
-    STATS.reviews = {
-      icon: icons.reviews,
-      label: i18n.t("statcard.reviews"),
-      value: totalReviews,
-      id: "reviews",
-    };
-  }
-
   const longLocales = [
     "cn",
     "es",
diff --git a/src/cards/top-languages-card.js b/src/cards/top-languages-card.js
index a757114..4e8ed3c 100644
--- a/src/cards/top-languages-card.js
+++ b/src/cards/top-languages-card.js
@@ -17,6 +17,7 @@ const MIN_CARD_WIDTH = 280;
 const DEFAULT_LANG_COLOR = "#858585";
 const CARD_PADDING = 25;
 const COMPACT_LAYOUT_BASE_HEIGHT = 90;
+const MAXIMUM_LANGS_COUNT = 20;
 
 const NORMAL_LAYOUT_DEFAULT_LANGS_COUNT = 5;
 const COMPACT_LAYOUT_DEFAULT_LANGS_COUNT = 6;
@@ -163,14 +164,14 @@ const donutCenterTranslation = (totalLangs) => {
  * Trim top languages to lang_count while also hiding certain languages.
  *
  * @param {Record<string, Lang>} topLangs Top languages.
- * @param {string[]} hide Languages to hide.
  * @param {string} langs_count Number of languages to show.
- * @returns {{topLangs: Record<string, Lang>, totalSize: number}} Trimmed top languages and total size.
+ * @param {string[]=} hide Languages to hide.
+ * @returns {{ langs: Lang[], totalLanguageSize: number }} Trimmed top languages and total size.
  */
-const trimTopLanguages = (topLangs, hide, langs_count) => {
+const trimTopLanguages = (topLangs, langs_count, hide) => {
   let langs = Object.values(topLangs);
   let langsToHide = {};
-  let langsCount = clampValue(parseInt(langs_count), 1, 10);
+  let langsCount = clampValue(parseInt(langs_count), 1, MAXIMUM_LANGS_COUNT);
 
   // populate langsToHide map for quick lookup
   // while filtering out
@@ -733,8 +734,8 @@ const renderTopLanguages = (topLangs, options = {}) => {
 
   const { langs, totalLanguageSize } = trimTopLanguages(
     topLangs,
-    hide,
     String(langs_count),
+    hide,
   );
 
   let width = isNaN(card_width)
diff --git a/src/translations.js b/src/translations.js
index 01da0a8..d6d173e 100644
--- a/src/translations.js
+++ b/src/translations.js
@@ -199,30 +199,34 @@ const statCardLocales = ({ name, apostrophe }) => {
       se: "Bidragit till (förra året)",
     },
     "statcard.reviews": {
-      ar: "إجمالي مراجعات العلاقات العامة",
-      cn: "公关评论总数",
-      cs: "Celkové PR recenze",
-      de: "Gesamtzahl der PR-Bewertungen",
-      en: "Total PR reviews",
-      bn: "মোট জনসংযোগ পর্যালোচনা",
-      es: "Revisiones de relaciones públicas totales",
-      fr: "Total des revues de relations publiques",
-      hu: "Összes PR értékelés",
-      it: "Totale recensioni di pubbliche relazioni",
-      ja: "PRレビューの合計",
-      kr: "총 PR 리뷰",
-      nl: "Totale PR-recensies",
-      "pt-pt": "Total de avaliações de relações públicas",
-      "pt-br": "Total de avaliações de relações públicas",
-      np: "कुल PR समीक्षाहरू",
-      el: "Συνολικές κριτικές δημοσίων σχέσεων",
-      ru: "Всего PR отзывов",
-      "uk-ua": "Тотальний PR оглядів",
-      id: "Ulasan PR total",
-      my: "စုစုပေါင်း PR သုံးသပ်ချက်",
-      sk: "Celkové hodnotenia PR",
-      tr: "Toplam halkla ilişkiler incelemesi",
-      pl: "Razem recenzje PR",
+      ar: "تمت مراجعة إجمالي العلاقات العامة",
+      cn: "審查的 PR 總數",
+      "zh-tw": "审查的 PR 总数",
+      cs: "Celkový počet PR",
+      de: "Insgesamt überprüfte PRs",
+      en: "Total PRs reviewed",
+      bn: "সর্বমোট পুনরালোচনা করা PR",
+      es: "PR totales revisados",
+      fr: "Nombre total de PR examinés",
+      hu: "Összes ellenőrzött PR",
+      it: "PR totali esaminati",
+      ja: "レビューされた PR の総数",
+      kr: "검토된 총 PR",
+      nl: "Totaal beoordeelde PR's",
+      "pt-pt": "Total de PRs revistos",
+      "pt-br": "Total de PRs revisados",
+      np: "कुल पीआर समीक्षित",
+      el: "Σύνολο Αναθεωρημένων PR",
+      ru: "Всего pull request`ов проверено",
+      "uk-ua": "Всього pull request`iв перевірено",
+      id: "Total PR yang Direview",
+      my: "Jumlah PR Dikaji Semula",
+      sk: "Celkový počet PR",
+      tr: "İncelenen toplam PR",
+      pl: "Łącznie sprawdzonych PR",
+      uz: "Koʻrib chiqilgan PR-lar soni",
+      vi: "Tổng Số PR Đã Xem Xét",
+      se: "Totalt antal granskade PR",
     },
   };
 };


Test patch:
diff --git a/tests/renderTopLanguages.test.js b/tests/renderTopLanguages.test.js
index e9e43f2..fb42fbb 100644
--- a/tests/renderTopLanguages.test.js
+++ b/tests/renderTopLanguages.test.js
@@ -310,21 +310,19 @@ describe("Test renderTopLanguages helper functions", () => {
       langs: [langs.javascript],
       totalLanguageSize: 200,
     });
-    expect(
-      trimTopLanguages([langs.javascript, langs.HTML], [], 5),
-    ).toStrictEqual({
+    expect(trimTopLanguages([langs.javascript, langs.HTML], 5)).toStrictEqual({
       langs: [langs.javascript, langs.HTML],
       totalLanguageSize: 400,
     });
-    expect(trimTopLanguages(langs, [], 5)).toStrictEqual({
+    expect(trimTopLanguages(langs, 5)).toStrictEqual({
       langs: Object.values(langs),
       totalLanguageSize: 500,
     });
-    expect(trimTopLanguages(langs, [], 2)).toStrictEqual({
+    expect(trimTopLanguages(langs, 2)).toStrictEqual({
       langs: Object.values(langs).slice(0, 2),
       totalLanguageSize: 400,
     });
-    expect(trimTopLanguages(langs, ["javascript"], 5)).toStrictEqual({
+    expect(trimTopLanguages(langs, 5, ["javascript"])).toStrictEqual({
       langs: [langs.HTML, langs.css],
       totalLanguageSize: 300,
     });