diff --git a/az_locale/fixtures/countries.json b/az_locale/fixtures/countries.json new file mode 100644 index 0000000..885f0ea --- /dev/null +++ b/az_locale/fixtures/countries.json @@ -0,0 +1,16 @@ +[ + { + "doctype": "Country", + "name": "Azerbaijan", + "code": "AZ", + "currency": "AZN", + "currency_name": "Azerbaijani Manat", + "currency_symbol": "₼", + "currency_fraction": "Qəpik", + "currency_fraction_units": 100, + "smallest_currency_fraction_value": 0.01, + "number_format": "#,###.##", + "timezones": ["Asia/Baku"], + "isd": "+994" + } +] diff --git a/az_locale/fixtures/languages.json b/az_locale/fixtures/languages.json new file mode 100644 index 0000000..225c1af --- /dev/null +++ b/az_locale/fixtures/languages.json @@ -0,0 +1,8 @@ +[ + { + "doctype": "Language", + "language_code": "az", + "language_name": "Azərbaycan", + "enabled": 1 + } +] diff --git a/az_locale/geo/update_country_info.py b/az_locale/geo/update_country_info.py deleted file mode 100644 index 3e2fdd7..0000000 --- a/az_locale/geo/update_country_info.py +++ /dev/null @@ -1,22 +0,0 @@ -import json -import os -from frappe.utils import get_bench_path - -def update_country_info(): - file_path = os.path.join(get_bench_path(), "apps", "frappe", "frappe", "geo", "country_info.json") - - # Читаем JSON - with open(file_path, "r", encoding="utf-8") as f: - data = json.load(f) - - # Проверяем, есть ли "Azerbaijan" в данных - if "Azerbaijan" in data: - data["Azerbaijan"]["currency"] = "AZN" # Добавляем валюту - data["Azerbaijan"]["currency_fraction"] = "Qəpik" # Исправляем значение - data["Azerbaijan"]["currency_symbol"] = "₼" # Добавляем символ маната - data["Azerbaijan"]["currency_name"] = "Azerbaijani Manat" # Добавляем название валюты - data["Azerbaijan"]["currency_fraction_units"] = 100 # Добавляем дробные единицы (копейки) - - # Записываем обратно в JSON - with open(file_path, "w", encoding="utf-8") as f: - json.dump(data, f, indent=4, ensure_ascii=False) diff --git a/az_locale/hooks.py b/az_locale/hooks.py index 722c97d..cc7c07c 100644 --- a/az_locale/hooks.py +++ b/az_locale/hooks.py @@ -7,7 +7,11 @@ app_license = "unlicense" after_install = "az_locale.install.after_install" -# fixtures = ["fixtures/currency.json"] +fixtures = [ + "fixtures/currency.json", + "fixtures/languages.json", + "fixtures/countries.json" +] # Apps # ------------------ diff --git a/az_locale/install.py b/az_locale/install.py index 91e3f0e..bf9e2d7 100644 --- a/az_locale/install.py +++ b/az_locale/install.py @@ -1,8 +1,4 @@ -from az_locale.geo.update_country_info import update_country_info from az_locale.locale.setup_locale import setup_locale -from az_locale.locale.update_languages import update_languages def after_install(): - update_country_info() # Обновляем страны setup_locale() # Добавляем файлы локализации - update_languages() # Добавляем азербайджанский язык