2019-10-12 18:23:08 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
# List Available Language Packs
|
|
|
|
# Used for updating the Languages page of the documentation.
|
2023-11-08 00:09:38 +01:00
|
|
|
# https://hugoblox.com
|
2019-10-12 18:23:08 +02:00
|
|
|
#
|
|
|
|
# Prerequisites: pip3 install PyYAML
|
|
|
|
|
|
|
|
import yaml
|
2020-01-25 23:35:02 +01:00
|
|
|
from pathlib import Path
|
2019-10-12 18:23:08 +02:00
|
|
|
|
2023-11-08 00:09:38 +01:00
|
|
|
LANG_PATH = Path(__file__).resolve().parent.parent.joinpath('blox-tailwind').joinpath('data').joinpath('i18n')
|
2019-10-12 18:23:08 +02:00
|
|
|
LANG_YAML = LANG_PATH.joinpath('languages.yaml')
|
|
|
|
|
|
|
|
|
|
|
|
# Iterate over languages.
|
|
|
|
with open(LANG_YAML) as f:
|
|
|
|
master_map = yaml.safe_load(f)
|
|
|
|
|
|
|
|
# Print languages as a plaintext list.
|
|
|
|
# lang_list = [master_map[master_item] for master_item in master_map]
|
|
|
|
# print(', '.join(lang_list))
|
|
|
|
|
|
|
|
# Print languages as a Markdown list.
|
2020-01-25 23:35:02 +01:00
|
|
|
i = 0
|
2019-10-12 18:23:08 +02:00
|
|
|
for master_item in master_map:
|
|
|
|
print(f'- **{master_map[master_item]}** ({master_item})')
|
2020-01-25 23:35:02 +01:00
|
|
|
i += 1
|
|
|
|
|
|
|
|
print("\n")
|
|
|
|
print(f"{i} language packs found!")
|