diff options
Diffstat (limited to 'python-locales.spec')
| -rw-r--r-- | python-locales.spec | 291 |
1 files changed, 291 insertions, 0 deletions
diff --git a/python-locales.spec b/python-locales.spec new file mode 100644 index 0000000..9cc5aa3 --- /dev/null +++ b/python-locales.spec @@ -0,0 +1,291 @@ +%global _empty_manifest_terminate_build 0 +Name: python-Locales +Version: 0.0.2 +Release: 1 +Summary: Module for multilingual solutions +License: MIT License +URL: https://github.com/vffuunnyy/Locales +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/a9/49/89c3242769d5fdcf96d437601fa182fcb65209153567911c06ee5a5132e5/Locales-0.0.2.tar.gz +BuildArch: noarch + + +%description +# Locales + +Locales - module for multilingual projects + +## Getting Started + +### Prerequisites + +Locales uses only standard library **json**. You need to write the translations in *json format* + +```json +{ + "languages": { + "ru": "Русский", "eng": "English", "sp": "Español" + }, + + "messages": { + "welcome": { + "ru": "Добро пожаловать!", + "eng": "Welcome!" + }, + "goodbye": { + "ru": "Пока", + "eng": "Goodbye", + "sp": "Adiós" + } + } +} +``` +Keys `languages` and `messages` required. + +To generate the same file use: +```python +import Locales + +Locales().example() +``` + +### Installing + +You can install Locales using pip + +```sh +$ pip install locales +``` +or download `Locales.py` and drop to folder with your project + +### Using + +```python +import Locales + +loc = Locales("filename.json") +loc.set_default_lang("eng") # Set the language by default + +print(loc.get("welcome")) +# Welcome! + +print(loc.get("welcome", "ru")) +# Добро пожаловать! + +print(loc.get_all("goodbye") +# dict of key "goodbye" -> {'ru': 'Пока', 'eng': 'Goodbye', 'sp': 'Adiós'} + +print(loc.get_by_name("English")) +# returns the abbreviation(key) of the language -> eng +``` + +## Authors + +* **vffuunnyy** - *Initial work* - [@vffuunnyy](https://t.me/vffuunnyy) + + + + +%package -n python3-Locales +Summary: Module for multilingual solutions +Provides: python-Locales +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-Locales +# Locales + +Locales - module for multilingual projects + +## Getting Started + +### Prerequisites + +Locales uses only standard library **json**. You need to write the translations in *json format* + +```json +{ + "languages": { + "ru": "Русский", "eng": "English", "sp": "Español" + }, + + "messages": { + "welcome": { + "ru": "Добро пожаловать!", + "eng": "Welcome!" + }, + "goodbye": { + "ru": "Пока", + "eng": "Goodbye", + "sp": "Adiós" + } + } +} +``` +Keys `languages` and `messages` required. + +To generate the same file use: +```python +import Locales + +Locales().example() +``` + +### Installing + +You can install Locales using pip + +```sh +$ pip install locales +``` +or download `Locales.py` and drop to folder with your project + +### Using + +```python +import Locales + +loc = Locales("filename.json") +loc.set_default_lang("eng") # Set the language by default + +print(loc.get("welcome")) +# Welcome! + +print(loc.get("welcome", "ru")) +# Добро пожаловать! + +print(loc.get_all("goodbye") +# dict of key "goodbye" -> {'ru': 'Пока', 'eng': 'Goodbye', 'sp': 'Adiós'} + +print(loc.get_by_name("English")) +# returns the abbreviation(key) of the language -> eng +``` + +## Authors + +* **vffuunnyy** - *Initial work* - [@vffuunnyy](https://t.me/vffuunnyy) + + + + +%package help +Summary: Development documents and examples for Locales +Provides: python3-Locales-doc +%description help +# Locales + +Locales - module for multilingual projects + +## Getting Started + +### Prerequisites + +Locales uses only standard library **json**. You need to write the translations in *json format* + +```json +{ + "languages": { + "ru": "Русский", "eng": "English", "sp": "Español" + }, + + "messages": { + "welcome": { + "ru": "Добро пожаловать!", + "eng": "Welcome!" + }, + "goodbye": { + "ru": "Пока", + "eng": "Goodbye", + "sp": "Adiós" + } + } +} +``` +Keys `languages` and `messages` required. + +To generate the same file use: +```python +import Locales + +Locales().example() +``` + +### Installing + +You can install Locales using pip + +```sh +$ pip install locales +``` +or download `Locales.py` and drop to folder with your project + +### Using + +```python +import Locales + +loc = Locales("filename.json") +loc.set_default_lang("eng") # Set the language by default + +print(loc.get("welcome")) +# Welcome! + +print(loc.get("welcome", "ru")) +# Добро пожаловать! + +print(loc.get_all("goodbye") +# dict of key "goodbye" -> {'ru': 'Пока', 'eng': 'Goodbye', 'sp': 'Adiós'} + +print(loc.get_by_name("English")) +# returns the abbreviation(key) of the language -> eng +``` + +## Authors + +* **vffuunnyy** - *Initial work* - [@vffuunnyy](https://t.me/vffuunnyy) + + + + +%prep +%autosetup -n Locales-0.0.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-Locales -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.2-1 +- Package Spec generated |
