@salesforcedevs/docs-components 1.28.5 → 1.28.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.28.5",
3
+ "version": "1.28.6",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -25,5 +25,5 @@
25
25
  "@types/lodash.orderby": "4.6.9",
26
26
  "@types/lodash.uniqby": "4.7.9"
27
27
  },
28
- "gitHead": "100b05d78eeebe4c0e1d76afdfaa630a0fecd4c9"
28
+ "gitHead": "88933f24674487cc3903ffc7ee6738523e615df5"
29
29
  }
@@ -43,7 +43,7 @@
43
43
  ></path>
44
44
  </g>
45
45
  </svg>
46
- {readingTime} minute read
46
+ {readingTimeLabel}
47
47
  </div>
48
48
  <div class="share-below-read" lwc:if={showSocialShare}>
49
49
  <doc-social-share
@@ -28,6 +28,35 @@ const HIGHLIGHTABLE_SELECTOR = [
28
28
  ].join(",");
29
29
  export const OBSERVER_ATTACH_WAIT_TIME = 500;
30
30
 
31
+ const DEFAULT_READING_TIME_LOCALE = "en-us";
32
+
33
+ /**
34
+ * Localized "minute read" templates. `{minutes}` is replaced with the rounded
35
+ * reading-time value. Only displayed when reading time is greater than 1, so
36
+ * plural forms are always appropriate. Keys match the locales declared in
37
+ * sfdocs (and the doc-locale-banner) so that a localized document automatically
38
+ * gets a localized reading-time label.
39
+ */
40
+ export const READING_TIME_LABELS: Record<string, string> = {
41
+ "en-us": "{minutes} minute read",
42
+ "ja-jp": "読了時間 {minutes} 分",
43
+ "zh-cn": "阅读时间 {minutes} 分钟",
44
+ "zh-tw": "閱讀時間 {minutes} 分鐘",
45
+ "fr-fr": "Lecture de {minutes} minutes",
46
+ "de-de": "{minutes} Minuten Lesezeit",
47
+ "it-it": "{minutes} minuti di lettura",
48
+ "ko-kr": "읽는 데 {minutes}분",
49
+ "pt-br": "{minutes} minutos de leitura",
50
+ "es-mx": "{minutes} minutos de lectura",
51
+ "es-es": "{minutes} minutos de lectura",
52
+ "ru-ru": "Время чтения: {minutes} мин",
53
+ "fi-fi": "{minutes} minuutin lukuaika",
54
+ "da-dk": "{minutes} minutters læsning",
55
+ "sv-se": "{minutes} minuters läsning",
56
+ "nl-nl": "{minutes} minuten leestijd",
57
+ "nb-no": "{minutes} minutters lesetid"
58
+ };
59
+
31
60
  export default class ContentLayout extends LightningElement {
32
61
  @api sidebarValue!: string;
33
62
  @api sidebarHeader!: string;
@@ -173,6 +202,23 @@ export default class ContentLayout extends LightningElement {
173
202
  return this.readingTime != null && this.readingTime > 1;
174
203
  }
175
204
 
205
+ /**
206
+ * Localized "X minute read" string for the current document language.
207
+ * Falls back to the default (en-us) template when the language is missing
208
+ * or has no translation. Returns an empty string when reading time is not
209
+ * displayed so the template stays empty in that case.
210
+ */
211
+ get readingTimeLabel(): string {
212
+ if (!this.showReadingTime) {
213
+ return "";
214
+ }
215
+ const localeKey = (this.language || "").toLowerCase();
216
+ const template =
217
+ READING_TIME_LABELS[localeKey] ||
218
+ READING_TIME_LABELS[DEFAULT_READING_TIME_LOCALE];
219
+ return template.replace("{minutes}", String(this.readingTime));
220
+ }
221
+
176
222
  /** When origin is provided, pass it to the footer; otherwise use dx-footer's default. */
177
223
  get effectiveFooterOrigin(): string {
178
224
  return (
@@ -41,7 +41,7 @@
41
41
  ></path>
42
42
  </g>
43
43
  </svg>
44
- {readingTime} minute read
44
+ {readingTimeLabel}
45
45
  </div>
46
46
  <slot onslotchange={onSlotChange}></slot>
47
47
  <doc-sprig-survey