Skip to content

Commit cb2f55e

Browse files
authored
Merge pull request #44869 from dipesh-rawat/sort-language-dropdown
Enhance language dropdown ordering
2 parents 54145dd + a1d4ec4 commit cb2f55e

File tree

2 files changed

+98
-93
lines changed

2 files changed

+98
-93
lines changed

content/en/docs/contribute/localization.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,11 @@ script and use it in the theme. Assign "language name in latin script" to
187187
`languageNameLatinScript`. For example, `languageNameLatinScript ="Korean"` or
188188
`languageNameLatinScript = "Deutsch"`.
189189

190-
When assigning a `weight` parameter for your block, find the language block with
191-
the highest weight and add 1 to that value.
190+
The `weight` parameter determines the order of languages in the language selection bar.
191+
A lower weight takes precedence, resulting in the language appearing first.
192+
When assigning the `weight` parameter, it is important to examine the existing languages
193+
block and adjust their weights to ensure they are in a sorted order relative to all languages,
194+
including any newly added language.
192195

193196
For more information about Hugo's multilingual support, see
194197
"[Multilingual Mode](https://gohugo.io/content-management/multilingual/)".

hugo.toml

Lines changed: 93 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -318,50 +318,66 @@ language_alternatives = ["en"]
318318
languageNameLatinScript = "Chinese"
319319
description = "生产级别的容器编排系统"
320320

321-
[languages.ko]
321+
[languages.fr]
322322
title = "Kubernetes"
323-
languageName = "한국어 (Korean)"
323+
languageName = "Français (French)"
324324
weight = 3
325-
contentDir = "content/ko"
325+
contentDir = "content/fr"
326326
languagedirection = "ltr"
327327

328-
[languages.ko.params]
329-
time_format_blog = "2006.01.02"
328+
[languages.fr.params]
329+
time_format_blog = "02.01.2006"
330+
# A list of language codes to look for untranslated content, ordered from left to right.
330331
language_alternatives = ["en"]
331-
description = "운영 수준의 컨테이너 오케스트레이션"
332-
languageNameLatinScript = "Korean"
332+
description = "Solution professionnelle d’orchestration de conteneurs"
333+
languageNameLatinScript = "Français"
333334

334-
[languages.ja]
335+
[languages.de]
335336
title = "Kubernetes"
336-
languageName = "日本語 (Japanese)"
337+
languageName = "Deutsch (German)"
337338
weight = 4
338-
contentDir = "content/ja"
339+
contentDir = "content/de"
339340
languagedirection = "ltr"
340341

341-
[languages.ja.params]
342-
time_format_blog = "2006.01.02"
342+
[languages.de.params]
343+
time_format_blog = "02.01.2006"
344+
# A list of language codes to look for untranslated content, ordered from left to right.
343345
language_alternatives = ["en"]
344-
languageNameLatinScript = "Japanese"
345-
description = "プロダクショングレードのコンテナ管理基盤"
346+
description = "Produktionsreife Container-Orchestrierung"
347+
languageNameLatinScript = "Deutsch"
346348

347-
[languages.fr]
349+
[languages.hi]
348350
title = "Kubernetes"
349-
languageName = "Français (French)"
351+
languageName = "हिन्दी (Hindi)"
350352
weight = 5
351-
contentDir = "content/fr"
353+
contentDir = "content/hi"
352354
languagedirection = "ltr"
353355

354-
[languages.fr.params]
356+
[languages.hi.params]
355357
time_format_blog = "02.01.2006"
356358
# A list of language codes to look for untranslated content, ordered from left to right.
357359
language_alternatives = ["en"]
358-
description = "Solution professionnelle d’orchestration de conteneurs"
359-
languageNameLatinScript = "Français"
360+
description = "प्रोडक्शन-ग्रेड कंटेनर ऑर्केस्ट्रेशन"
361+
languageNameLatinScript = "Hindi"
362+
363+
[languages.id]
364+
title = "Kubernetes"
365+
languageName ="Bahasa Indonesia (Indonesian)"
366+
weight = 6
367+
contentDir = "content/id"
368+
languagedirection = "ltr"
369+
370+
[languages.id.params]
371+
time_format_blog = "02.01.2006"
372+
# A list of language codes to look for untranslated content, ordered from left to right.
373+
language_alternatives = ["en"]
374+
description = "Orkestrasi Kontainer dengan Skala Produksi"
375+
languageNameLatinScript = "Bahasa Indonesia"
360376

361377
[languages.it]
362378
title = "Kubernetes"
363379
languageName = "Italiano (Italian)"
364-
weight = 6
380+
weight = 7
365381
contentDir = "content/it"
366382
languagedirection = "ltr"
367383

@@ -372,6 +388,27 @@ language_alternatives = ["en"]
372388
description = "Orchestrazione di Container in produzione"
373389
languageNameLatinScript = "Italiano"
374390

391+
[languages.ja]
392+
title = "Kubernetes"
393+
languageName = "日本語 (Japanese)"
394+
weight = 8
395+
contentDir = "content/ja"
396+
languagedirection = "ltr"
397+
398+
[languages.ja.params]
399+
time_format_blog = "2006.01.02"
400+
language_alternatives = ["en"]
401+
languageNameLatinScript = "Japanese"
402+
description = "プロダクショングレードのコンテナ管理基盤"
403+
404+
[languages.ko]
405+
title = "Kubernetes"
406+
languageName = "한국어 (Korean)"
407+
weight = 9
408+
contentDir = "content/ko"
409+
languagedirection = "ltr"
410+
411+
# 'Norsk (Norwegian)' language is disabled via 'disableLanguages' config.
375412
[languages.no]
376413
title = "Kubernetes"
377414
languageName = "Norsk (Norwegian)"
@@ -386,38 +423,30 @@ language_alternatives = ["en"]
386423
description = "Production-Grade Container Orchestration"
387424
languageNameLatinScript = "Norsk"
388425

389-
[languages.de]
390-
title = "Kubernetes"
391-
languageName = "Deutsch (German)"
392-
weight = 8
393-
contentDir = "content/de"
394-
languagedirection = "ltr"
395-
396-
[languages.de.params]
397-
time_format_blog = "02.01.2006"
398-
# A list of language codes to look for untranslated content, ordered from left to right.
426+
[languages.ko.params]
427+
time_format_blog = "2006.01.02"
399428
language_alternatives = ["en"]
400-
description = "Produktionsreife Container-Orchestrierung"
401-
languageNameLatinScript = "Deutsch"
429+
description = "운영 수준의 컨테이너 오케스트레이션"
430+
languageNameLatinScript = "Korean"
402431

403-
[languages.es]
432+
[languages.pl]
404433
title = "Kubernetes"
405-
languageName = "Español (Spanish)"
406-
weight = 9
407-
contentDir = "content/es"
434+
languageName = "Polski (Polish)"
435+
weight = 10
436+
contentDir = "content/pl"
408437
languagedirection = "ltr"
409438

410-
[languages.es.params]
411-
time_format_blog = "02.01.2006"
439+
[languages.pl.params]
440+
time_format_blog = "01.02.2006"
412441
# A list of language codes to look for untranslated content, ordered from left to right.
413442
language_alternatives = ["en"]
414-
description = "Orquestación de contenedores para producción"
415-
languageNameLatinScript = "Español"
443+
description = "Produkcyjny system zarządzania kontenerami"
444+
languageNameLatinScript = "Polski"
416445

417446
[languages.pt-br]
418447
title = "Kubernetes"
419448
languageName = "Português (Portuguese)"
420-
weight = 10
449+
weight = 11
421450

422451
contentDir = "content/pt-br"
423452
languagedirection = "ltr"
@@ -429,49 +458,10 @@ language_alternatives = ["en"]
429458
description = "Orquestração de contêineres em nível de produção"
430459
languageNameLatinScript = "Português"
431460

432-
[languages.id]
433-
title = "Kubernetes"
434-
languageName ="Bahasa Indonesia"
435-
weight = 11
436-
contentDir = "content/id"
437-
languagedirection = "ltr"
438-
439-
[languages.id.params]
440-
time_format_blog = "02.01.2006"
441-
# A list of language codes to look for untranslated content, ordered from left to right.
442-
language_alternatives = ["en"]
443-
description = "Orkestrasi Kontainer dengan Skala Produksi"
444-
languageNameLatinScript = "Bahasa Indonesia"
445-
446-
[languages.hi]
447-
title = "Kubernetes"
448-
languageName = "हिन्दी (Hindi)"
449-
weight = 12
450-
contentDir = "content/hi"
451-
languagedirection = "ltr"
452-
453-
[languages.hi.params]
454-
time_format_blog = "02.01.2006"
455-
# A list of language codes to look for untranslated content, ordered from left to right.
456-
language_alternatives = ["en"]
457-
description = "प्रोडक्शन-ग्रेड कंटेनर ऑर्केस्ट्रेशन"
458-
languageNameLatinScript = "Hindi"
459-
460-
[languages.vi]
461-
title = "Kubernetes"
462-
languageName = "Tiếng Việt (Vietnamese)"
463-
contentDir = "content/vi"
464-
weight = 13
465-
languagedirection = "ltr"
466-
467-
[languages.vi.params]
468-
languageNameLatinScript = "Tiếng Việt"
469-
description = "Giải pháp điều phối container trong môi trường production"
470-
471461
[languages.ru]
472462
title = "Kubernetes"
473463
languageName = "Русский (Russian)"
474-
weight = 14
464+
weight = 12
475465
contentDir = "content/ru"
476466
languagedirection = "ltr"
477467

@@ -482,24 +472,24 @@ language_alternatives = ["en"]
482472
description = "Первоклассная оркестрация контейнеров"
483473
languageNameLatinScript = "Russian"
484474

485-
[languages.pl]
475+
[languages.es]
486476
title = "Kubernetes"
487-
languageName = "Polski (Polish)"
488-
weight = 15
489-
contentDir = "content/pl"
477+
languageName = "Español (Spanish)"
478+
weight = 13
479+
contentDir = "content/es"
490480
languagedirection = "ltr"
491481

492-
[languages.pl.params]
493-
time_format_blog = "01.02.2006"
482+
[languages.es.params]
483+
time_format_blog = "02.01.2006"
494484
# A list of language codes to look for untranslated content, ordered from left to right.
495485
language_alternatives = ["en"]
496-
description = "Produkcyjny system zarządzania kontenerami"
497-
languageNameLatinScript = "Polski"
486+
description = "Orquestación de contenedores para producción"
487+
languageNameLatinScript = "Español"
498488

499489
[languages.uk]
500490
title = "Kubernetes"
501491
languageName = "Українська (Ukrainian)"
502-
weight = 16
492+
weight = 14
503493
contentDir = "content/uk"
504494
languagedirection = "ltr"
505495

@@ -509,3 +499,15 @@ time_format_blog = "02.01.2006"
509499
language_alternatives = ["en"]
510500
description = "Довершена система оркестрації контейнерів"
511501
languageNameLatinScript = "Ukrainian"
502+
503+
[languages.vi]
504+
title = "Kubernetes"
505+
languageName = "Tiếng Việt (Vietnamese)"
506+
contentDir = "content/vi"
507+
weight = 15
508+
languagedirection = "ltr"
509+
510+
[languages.vi.params]
511+
languageNameLatinScript = "Tiếng Việt"
512+
description = "Giải pháp điều phối container trong môi trường production"
513+

0 commit comments

Comments
 (0)