Files
django-nepkit/django_nepkit/constants.py
T
sankalp 718cff2951 refactor: remove code redundancy and improve maintainability
- Extract duplicate view logic into reusable helper functions in views.py
- Move circular import from module level to method scope in models.py
- Create constants.py for centralized hardcoded values (Nepali words, placeholders)
- Simplify number_to_nepali_words function from 157 to 42 lines
- Refactor normalize_address with extracted helper functions
- Add lang_utils.py for consistent language parameter handling
- Reduce JavaScript duplication in address-chaining.js with helper functions
- Remove ~160+ lines of redundant code while preserving all logic
- All 79 tests passing, ruff linting passes
2026-02-05 20:49:26 +05:45

130 lines
3.4 KiB
Python

"""
Constants for django-nepkit package.
Contains hardcoded values, word mappings, and configuration data.
"""
# Nepali number words mapping (0-99)
NEPALI_ONES = [
"",
"एक",
"दुई",
"तीन",
"चार",
"पाँच",
"छ",
"सात",
"आठ",
"नौ",
"दश",
"एघार",
"बाह्र",
"तेह्र",
"चौध",
"पन्ध्र",
"सोह्र",
"सत्र",
"अठार",
"उन्नाइस",
"बीस",
"एकाइस",
"बाइस",
"तेईस",
"चौबीस",
"पच्चीस",
"छब्बीस",
"सत्ताइस",
"अठाइस",
"उनन्तीस",
"तीस",
"एकतीस",
"बत्तीस",
"तेत्तीस",
"चौंतीस",
"पैंतीस",
"छत्तीस",
"सैंतीस",
"अठतीस",
"उनन्चालीस",
"चालीस",
"एकचालीस",
"बयालीस",
"त्रिचालीस",
"चवालीस",
"पैंतालीस",
"छयालीस",
"सत्तालीस",
"अठचालीस",
"उनन्पचास",
"पचास",
"एकाउन्न",
"बाउन्न",
"त्रिपन्न",
"चउन्न",
"पचपन्न",
"छपन्न",
"सन्ताउन्न",
"अन्ठाउन्न",
"उनन्साठी",
"साठी",
"एकसाठी",
"बासट्ठी",
"त्रिसट्ठी",
"चौसट्ठी",
"पैंसट्ठी",
"छयसट्ठी",
"सतसट्ठी",
"अठसट्ठी",
"उनन्सत्तरी",
"सत्तरी",
"एकहत्तर",
"बाहत्तर",
"त्रिहत्तर",
"चौरहत्तर",
"पचहत्तर",
"छयहत्तर",
"सतहत्तर",
"अठहत्तर",
"उनन्असी",
"असी",
"एकासी",
"बयासी",
"त्रियासी",
"चौरासी",
"पचासी",
"छयासी",
"सतासी",
"अठासी",
"उनन्नब्बे",
"नब्बे",
"एकानब्बे",
"बयानब्बे",
"त्रियानब्बे",
"चौरानब्बे",
"पञ्चानब्बे",
"छ्यानब्बे",
"सन्तानब्बे",
"अन्ठानब्बे",
"उनन्सय",
]
# Nepali number units and their corresponding names
NEPALI_UNITS = [
("", ""),
(100, "सय"),
(1000, "हजार"),
(100000, "लाख"),
(10000000, "करोड"),
(1000000000, "अरब"),
(100000000000, "खरब"),
]
# Placeholder text for location selects
PLACEHOLDERS = {
"province": {"ne": "प्रदेश छान्नुहोस्", "en": "Select Province"},
"district": {"ne": "जिल्ला छान्नुहोस्", "en": "Select District"},
"municipality": {"ne": "नगरपालिका छान्नुहोस्", "en": "Select Municipality"},
}
# Internal parameters to exclude from fallback logic
INTERNAL_PARAMS = ["ne", "en", "html"]