Repository: anuraghazra/github-readme-stats
Pull request #2780 (2023-06-07 07:08:14)

Use compact layout default langs count when hide_progress param was set
Specifying `hide_progress` parameter switch card layout to compact. Currently if you use `&layout=compact` it shows 6 languages by default, but if you specify `&hide_progress=true` it still shows 5. This pull request fix this behavior.

![image](https://github.com/anuraghazra/github-readme-stats/assets/53787217/358ba551-e58a-4a57-98b2-5b3755dbbb40)

![image](https://github.com/anuraghazra/github-readme-stats/assets/53787217/6a88237c-b66b-4eef-974e-3333561dbb35)


vercel[bot]: [vc]: #E+3bu/8rAlOV1yNn68qpLH3dYZyPDOsWHb61InOU7bY=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJnaXRodWItcmVhZG1lLXN0YXRzIiwiaW5zcGVjdG9yVXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL2dpdGh1Yi1yZWFkbWUtc3RhdHMtdGVhbS9naXRodWItcmVhZG1lLXN0YXRzLzNkUFp1d2FOVUF0Y24zb0gzMlR1ZXpSbnBIOXQiLCJwcmV2aWV3VXJsIjoiZ2l0aHViLXJlYWRtZS1zdGF0cy1naXQtc2V0c2FtZS1jN2EyZTktZ2l0aHViLXJlYWRtZS1zdGF0cy10ZWFtLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQifV19
**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/3dPZuwaNUAtcn3oH32TuezRnpH9t)) | [Visit Preview](https://github-readme-stats-git-setsame-c7a2e9-github-readme-stats-team.vercel.app) | Jun 7, 2023 7:08am |



Patch:
diff --git a/readme.md b/readme.md
index 94e6a8a..1516ac1 100644
--- a/readme.md
+++ b/readme.md
@@ -154,8 +154,8 @@ You can look at a preview for [all available themes](./themes/README.md) or chec
 
 #### Responsive Card Theme
 
-[![Anurag's GitHub stats-Dark](https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=dark#gh-dark-mode-only)](https://github.com/anuraghazra/github-readme-stats#gh-dark-mode-only)
-[![Anurag's GitHub stats-Light](https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=default#gh-light-mode-only)](https://github.com/anuraghazra/github-readme-stats#gh-light-mode-only)
+[![Anurag's GitHub stats-Dark](https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=dark#gh-dark-mode-only)](https://github.com/anuraghazra/github-readme-stats#responsive-card-theme#gh-dark-mode-only)
+[![Anurag's GitHub stats-Light](https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=default#gh-light-mode-only)](https://github.com/anuraghazra/github-readme-stats#responsive-card-theme#gh-light-mode-only)
 
 Since GitHub will re-upload the cards and serve them from their [CDN](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-anonymized-urls), we can not infer the browser/GitHub theme on the server side. There are, however, four methods you can use to create dynamics themes on the client side.
 
@@ -342,11 +342,11 @@ Endpoint: `api/pin?username=anuraghazra&repo=github-readme-stats`
 
 ### Demo
 
-[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats)](https://github.com/anuraghazra/github-readme-stats)
+![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats)
 
 Use [show_owner](#customization) variable to include the repo's owner username
 
-[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&show_owner=true)](https://github.com/anuraghazra/github-readme-stats)
+![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&show_owner=true)
 
 # Top Languages Card
 
@@ -380,7 +380,7 @@ By default, only the byte count is used for determining the languages percentage
 -   `&size_weight=0&count_weight=1` - Orders by repo count
 
 ```md
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&size_weight=0.5&count_weight=0.5)](https://github.com/anuraghazra/github-readme-stats)
+![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&size_weight=0.5&count_weight=0.5)
 ```
 
 ### Exclude individual repositories
@@ -388,7 +388,7 @@ By default, only the byte count is used for determining the languages percentage
 You can use the `&exclude_repo=repo1,repo2` parameter to exclude individual repositories.
 
 ```md
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&exclude_repo=github-readme-stats,anuraghazra.github.io)](https://github.com/anuraghazra/github-readme-stats)
+![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&exclude_repo=github-readme-stats,anuraghazra.github.io)
 ```
 
 ### Hide individual languages
@@ -396,7 +396,7 @@ You can use the `&exclude_repo=repo1,repo2` parameter to exclude individual repo
 You can use `&hide=language1,language2` parameter to hide individual languages.
 
 ```md
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&hide=javascript,html)](https://github.com/anuraghazra/github-readme-stats)
+![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&hide=javascript,html)
 ```
 
 ### Show more languages
@@ -404,7 +404,7 @@ You can use `&hide=language1,language2` parameter to hide individual languages.
 You can use the `&langs_count=` option to increase or decrease the number of languages shown on the card. Valid values are integers between 1 and 10 (inclusive), and the default is 5.
 
 ```md
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&langs_count=8)](https://github.com/anuraghazra/github-readme-stats)
+![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&langs_count=8)
 ```
 
 ### Compact Language Card Layout
@@ -412,7 +412,7 @@ You can use the `&langs_count=` option to increase or decrease the number of lan
 You can use the `&layout=compact` option to change the card design.
 
 ```md
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&layout=compact)](https://github.com/anuraghazra/github-readme-stats)
+![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&layout=compact)
 ```
 
 ### Donut Chart Language Card Layout
@@ -444,16 +444,16 @@ You can use the `&layout=pie` option to change the card design.
 You can use the `&hide_progress=true` option to hide the percentages and the progress bars (layout will be automatically set to `compact`).
 
 ```md
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&hide_progress=true)](https://github.com/anuraghazra/github-readme-stats)
+![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&hide_progress=true)
 ```
 
 ### Demo
 
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra)](https://github.com/anuraghazra/github-readme-stats)
+![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra)
 
 -   Compact layout
 
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&layout=compact)](https://github.com/anuraghazra/github-readme-stats)
+![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&layout=compact)
 
 -   Donut Chart layout
 
@@ -469,7 +469,7 @@ You can use the `&hide_progress=true` option to hide the percentages and the pro
 
 -   Hidden progress bars
 
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&hide_progress=true)](https://github.com/anuraghazra/github-readme-stats)
+![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&hide_progress=true)
 
 # Wakatime Week Stats
 
@@ -484,13 +484,13 @@ Change the `?username=` value to your [Wakatime](https://wakatime.com) username.
 
 ### Demo
 
-[![Harlok's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=Harlok)](https://github.com/anuraghazra/github-readme-stats)
+![Harlok's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=Harlok)
 
-[![Harlok's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=Harlok&hide_progress=true)](https://github.com/anuraghazra/github-readme-stats)
+![Harlok's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=Harlok&hide_progress=true)
 
 -   Compact layout
 
-[![Harlok's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=Harlok&layout=compact)](https://github.com/anuraghazra/github-readme-stats)
+![Harlok's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=Harlok&layout=compact)
 
 * * *
 
@@ -544,11 +544,11 @@ Choose from any of the [default themes](#themes)
 
 -   Top languages
 
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra)](https://github.com/anuraghazra/github-readme-stats)
+![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra)
 
 -   WakaTime card
 
-[![Harlok's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=Harlok)](https://github.com/anuraghazra/github-readme-stats)
+![Harlok's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=Harlok)
 
 * * *
 
diff --git a/src/cards/stats-card.js b/src/cards/stats-card.js
index 4761d02..bf0c2c8 100644
--- a/src/cards/stats-card.js
+++ b/src/cards/stats-card.js
@@ -165,7 +165,7 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
     },
     contribs: {
       icon: icons.contribs,
-      label: i18n.t("statcard.contribs") + " (last year)",
+      label: i18n.t("statcard.contribs"),
       value: contributedTo,
       id: "contribs",
     },
diff --git a/src/cards/top-languages-card.js b/src/cards/top-languages-card.js
index d854c95..c7aff88 100644
--- a/src/cards/top-languages-card.js
+++ b/src/cards/top-languages-card.js
@@ -676,11 +676,13 @@ const noLanguagesDataNode = ({ color, text, layout }) => {
 /**
  * Get default languages count for provided card layout.
  *
- * @param {import("./types").TopLangOptions["layout"] | undefined} layout Input layout string
- * @return {number} Default languages count for input layout
+ * @param {object} props Function properties.
+ * @param {import("./types").TopLangOptions["layout"]=} props.layout Input layout string.
+ * @param {boolean=} props.hide_progress Input hide_progress parameter value.
+ * @return {number} Default languages count for input layout.
  */
-const getDefaultLanguagesCountByLayout = (layout) => {
-  if (layout === "compact") {
+const getDefaultLanguagesCountByLayout = ({ layout, hide_progress }) => {
+  if (layout === "compact" || hide_progress === true) {
     return COMPACT_LAYOUT_DEFAULT_LANGS_COUNT;
   } else if (layout === "donut") {
     return DONUT_LAYOUT_DEFAULT_LANGS_COUNT;
@@ -714,7 +716,7 @@ const renderTopLanguages = (topLangs, options = {}) => {
     layout,
     custom_title,
     locale,
-    langs_count = getDefaultLanguagesCountByLayout(layout),
+    langs_count = getDefaultLanguagesCountByLayout({ layout, hide_progress }),
     border_radius,
     border_color,
     disable_animations,
diff --git a/src/translations.js b/src/translations.js
index c123eb3..cea5059 100644
--- a/src/translations.js
+++ b/src/translations.js
@@ -166,35 +166,35 @@ const statCardLocales = ({ name, apostrophe }) => {
       se: "Total antal issues",
     },
     "statcard.contribs": {
-      ar: "ساهم في",
-      cn: "参与项目数",
-      "zh-tw": "參與項目數",
-      cs: "Přispěl k",
-      de: "Beigetragen zu",
-      en: "Contributed to",
-      bn: "অবদান রেখেছেন",
-      es: "Contribuciones en",
-      fr: "Contribué à",
-      hu: "Hozzájárulások",
-      it: "Ha contribuito a",
-      ja: "貢献したリポジトリ",
-      kr: "전체 기여도",
-      nl: "Bijgedragen aan",
-      "pt-pt": "Contribuiu em",
-      "pt-br": "Contribuiu para",
-      np: "कुल योगदानहरू",
-      el: "Συνεισφέρθηκε σε",
-      ru: "Внёс вклад в",
-      "uk-ua": "Вніс внесок у",
-      id: "Berkontribusi ke",
-      ml: "സമർപ്പിച്ചിരിക്കുന്നത്",
-      my: "Menyumbang kepada",
-      sk: "Účasti",
-      tr: "Katkı Verildi",
-      pl: "Kontrybucje",
-      uz: "Hissa qoʻshgan",
-      vi: "Đã Đóng Góp",
-      se: "Bidragit till",
+      ar: "ساهم في (العام الماضي)",
+      cn: "贡献于（去年）",
+      "zh-tw": "參與項目數 （去年）",
+      cs: "Přispěl k (minulý rok)",
+      de: "Beigetragen zu (letztes Jahr)",
+      en: "Contributed to (last year)",
+      bn: "অবদান (গত বছর)",
+      es: "Contribuciones en (el año pasado)",
+      fr: "Contribué à (l'année dernière)",
+      hu: "Hozzájárulások (tavaly)",
+      it: "Ha contribuito a (l'anno scorso)",
+      ja: "貢献したリポジトリ （昨年）",
+      kr: "(작년) 기여",
+      nl: "Bijgedragen aan (vorig jaar)",
+      "pt-pt": "Contribuiu em (ano passado)",
+      "pt-br": "Contribuiu para (ano passado)",
+      np: "कुल योगदानहरू (गत वर्ष)",
+      el: "Συνεισφέρθηκε σε (πέρυσι)",
+      ru: "Внёс вклад в (за прошлый год)",
+      "uk-ua": "Зробив внесок у (за минулий рік)",
+      id: "Berkontribusi ke (tahun lalu)",
+      ml: "സമർപ്പിച്ചിരിക്കുന്നത് (കഴിഞ്ഞ വർഷം)",
+      my: "Menyumbang kepada (tahun lepas)",
+      sk: "Účasti (minulý rok)",
+      tr: "Katkı Verildi (geçen yıl)",
+      pl: "Kontrybucje (w zeszłym roku)",
+      uz: "Hissa qoʻshgan (o'tgan yili)",
+      vi: "Đã Đóng Góp (năm ngoái)",
+      se: "Bidragit till (förra året)",
     },
   };
 };


Test patch:
diff --git a/tests/renderStatsCard.test.js b/tests/renderStatsCard.test.js
index 25c5feb..0dd5883 100644
--- a/tests/renderStatsCard.test.js
+++ b/tests/renderStatsCard.test.js
@@ -348,7 +348,7 @@ describe("Test renderStatsCard", () => {
       document.querySelector(
         'g[transform="translate(0, 100)"]>.stagger>.stat.bold',
       ).textContent,
-    ).toMatchInlineSnapshot(`"参与项目数 (last year):"`);
+    ).toMatchInlineSnapshot(`"贡献于（去年）:"`);
   });
 
   it("should render without rounding", () => {
diff --git a/tests/renderTopLanguages.test.js b/tests/renderTopLanguages.test.js
index c906dec..e9e43f2 100644
--- a/tests/renderTopLanguages.test.js
+++ b/tests/renderTopLanguages.test.js
@@ -331,12 +331,25 @@ describe("Test renderTopLanguages helper functions", () => {
   });
 
   it("getDefaultLanguagesCountByLayout", () => {
-    expect(getDefaultLanguagesCountByLayout("normal")).toStrictEqual(5);
-    expect(getDefaultLanguagesCountByLayout(undefined)).toStrictEqual(5);
-    expect(getDefaultLanguagesCountByLayout("compact")).toStrictEqual(6);
-    expect(getDefaultLanguagesCountByLayout("donut")).toStrictEqual(5);
-    expect(getDefaultLanguagesCountByLayout("donut-vertical")).toStrictEqual(6);
-    expect(getDefaultLanguagesCountByLayout("pie")).toStrictEqual(6);
+    expect(
+      getDefaultLanguagesCountByLayout({ layout: "normal" }),
+    ).toStrictEqual(5);
+    expect(getDefaultLanguagesCountByLayout({})).toStrictEqual(5);
+    expect(
+      getDefaultLanguagesCountByLayout({ layout: "compact" }),
+    ).toStrictEqual(6);
+    expect(
+      getDefaultLanguagesCountByLayout({ hide_progress: true }),
+    ).toStrictEqual(6);
+    expect(getDefaultLanguagesCountByLayout({ layout: "donut" })).toStrictEqual(
+      5,
+    );
+    expect(
+      getDefaultLanguagesCountByLayout({ layout: "donut-vertical" }),
+    ).toStrictEqual(6);
+    expect(getDefaultLanguagesCountByLayout({ layout: "pie" })).toStrictEqual(
+      6,
+    );
   });
 });