50 lines
936 B
Python
50 lines
936 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
from pathlib import Path
|
||
|
|
||
|
|
||
|
OUTPUT_DIR = 'html'
|
||
|
CHAPTERS = (
|
||
|
'overview',
|
||
|
'installation',
|
||
|
'mua',
|
||
|
'upgrade',
|
||
|
'iredmail-easy',
|
||
|
'migrations',
|
||
|
'howto',
|
||
|
'integrations',
|
||
|
'cluster',
|
||
|
'iredadmin',
|
||
|
'troubleshooting',
|
||
|
'faq')
|
||
|
|
||
|
|
||
|
def _get_dir_languages(path):
|
||
|
FILE_NAME = '_lang.md'
|
||
|
|
||
|
languages = {}
|
||
|
directories = [p for p in Path(path).iterdir() if p.is_dir()]
|
||
|
for d in directories:
|
||
|
path_name = d / FILE_NAME
|
||
|
if path_name.exists():
|
||
|
languages[d.name.lower()] = {
|
||
|
'path': d,
|
||
|
'name': path_name.read_text(encoding='utf-8').strip()
|
||
|
}
|
||
|
|
||
|
return languages
|
||
|
|
||
|
|
||
|
def main():
|
||
|
current_dir = Path(__file__).parent
|
||
|
output_dir = current_dir / OUTPUT_DIR
|
||
|
|
||
|
languages = _get_dir_languages(current_dir)
|
||
|
en = languages.pop('en_us')
|
||
|
|
||
|
return
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|