list_language_packs.py 811 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env python3
  2. # List Available Language Packs
  3. # Used for updating the Languages page of the documentation.
  4. # https://wowchemy.com
  5. #
  6. # Prerequisites: pip3 install PyYAML
  7. import yaml
  8. from pathlib import Path
  9. LANG_PATH = Path(__file__).resolve().parent.parent.joinpath('wowchemy').joinpath('data').joinpath('i18n')
  10. LANG_YAML = LANG_PATH.joinpath('languages.yaml')
  11. # Iterate over languages.
  12. with open(LANG_YAML) as f:
  13. master_map = yaml.safe_load(f)
  14. # Print languages as a plaintext list.
  15. # lang_list = [master_map[master_item] for master_item in master_map]
  16. # print(', '.join(lang_list))
  17. # Print languages as a Markdown list.
  18. i = 0
  19. for master_item in master_map:
  20. print(f'- **{master_map[master_item]}** ({master_item})')
  21. i += 1
  22. print("\n")
  23. print(f"{i} language packs found!")