@@ -480,26 +480,24 @@ def get_languages(source_path: str):
480
480
"""
481
481
Get the list of languages available in the translations directory.
482
482
"""
483
- languages_path = f"{ source_path } /pandas-translations-main/web/pandas/"
484
- en_path = f"{ languages_path } /en/"
483
+ en_path = f"{ source_path } /en/"
485
484
if os .path .exists (en_path ):
486
485
shutil .rmtree (en_path )
487
486
488
- paths = os .listdir (languages_path )
489
- return [path for path in paths if os .path .isdir (f"{ languages_path } /{ path } " )]
487
+ paths = os .listdir (source_path )
488
+ return [path for path in paths if os .path .isdir (f"{ source_path } /{ path } " )]
490
489
491
490
492
491
def copy_translations (source_path : str , target_path : str , languages : list [str ]):
493
492
"""
494
493
Copy the translations to the appropriate directory.
495
494
"""
496
- languages_path = f"{ source_path } /pandas-translations-main/web/pandas/"
497
495
for lang in languages :
498
496
cmds = [
499
497
"rsync" ,
500
498
"-av" ,
501
499
"--delete" ,
502
- f"{ languages_path } /{ lang } /" ,
500
+ f"{ source_path } /{ lang } /" ,
503
501
f"{ target_path } /{ lang } /" ,
504
502
]
505
503
p = Popen (cmds , stdout = PIPE , stderr = PIPE )
@@ -527,9 +525,14 @@ def main(
527
525
translations_path = os .path .join (base_folder , f"{ config ['translations' ]['folder' ]} " )
528
526
529
527
sys .stderr .write ("Downloading and extracting translations...\n " )
530
- download_and_extract_translations (config ["translations" ]["url" ], translations_path )
528
+ translations_source_path = os .path .join (
529
+ translations_path , config ["translations" ]["source_path" ]
530
+ )
531
+ download_and_extract_translations (
532
+ config ["translations" ]["url" ], translations_source_path
533
+ )
531
534
532
- translated_languages = get_languages (translations_path )
535
+ translated_languages = get_languages (translations_source_path )
533
536
default_language = config ["translations" ]["default_language" ]
534
537
languages = [default_language ] + translated_languages
535
538
0 commit comments