From 3b2fc5ee7e0f25999c296cc7fb5e7d90ad5f1641 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Thu, 28 Sep 2023 14:56:51 +0800 Subject: [PATCH] chore: auto create lang nuspec files. --- .gitignore | 1 + build/build.Lang.template.nuspec | 59 ++++++++++++++++++++++++++++++++ build/create_lang_nuspec_file.py | 15 ++++++++ 3 files changed, 75 insertions(+) create mode 100644 build/build.Lang.template.nuspec create mode 100644 build/create_lang_nuspec_file.py diff --git a/.gitignore b/.gitignore index b4a77255..903f36f4 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ packages/ build/* !build/build.cake !build/build*.nuspec +!build/create_lang_nuspec_file.py !build/build.ps1 !build/LICENSE !build/icon.png diff --git a/build/build.Lang.template.nuspec b/build/build.Lang.template.nuspec new file mode 100644 index 00000000..15777b68 --- /dev/null +++ b/build/build.Lang.template.nuspec @@ -0,0 +1,59 @@ + + + + HandyControl.Lang.{lang} + 3.5.0 + HandyOrg + HandyOrg + HandyOrg + true + LICENSE + icon.png + https://github.com/HandyOrg/HandyControl + Contains some simple and commonly used WPF controls + Changes are detailed at https://github.com/HandyOrg/HandyControl/releases + Copyright © HandyOrg 2018-2023 + WPF C# Control + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/create_lang_nuspec_file.py b/build/create_lang_nuspec_file.py new file mode 100644 index 00000000..d8c50ea0 --- /dev/null +++ b/build/create_lang_nuspec_file.py @@ -0,0 +1,15 @@ +from pathlib import Path + + +def main(): + with open('build.Lang.template.nuspec', 'r', encoding='utf-8') as template_file: + template_content = template_file.read() + + resx_file_folder = Path('../src/Shared/HandyControl_Shared/Properties/Langs') + for lang in [path.stem.lstrip('Lang.') for path in resx_file_folder.glob('Lang.*.resx')]: + with open(f'build.Lang.{lang}.nuspec', 'w', encoding='utf-8') as nuspec_file: + nuspec_file.write(template_content.format(lang=lang)) + + +if __name__ == '__main__': + main()