Collection of all Thai fonts, Convert month/year/number to thai
Project description
Thai Localization - Base Utils Thai
This module is a utility package for Thailand, providing helper functions commonly used in Thai-specific contexts.
It includes features such as:
Conversion between Arabic and Thai numerals
Thai month name and Buddhist calendar (Thai year) conversion
Thai font support:
Font THBaijam
Font THChakraPetch
Font THCharmofAU
Font THCharmonman
Font THFahKwang
Font THK2DJuly8
Font THKodchasal
Font THKoHo
Font THKrub
Font THMaliGrade6
Font THNiramitAS
Font THSarabun
Font THSarabunNew
Font THSrisakdi
Table of contents
Configuration
To configure the Thai font, go to Settings > General Settings > Business Documents > Configure Document Layout, then select the desired font and click Save.
Usage
This module provides a utility model thai.utils for Thai localization features such as number and date formatting. You can either call the methods directly via the environment, or inherit the abstract model in your own modules.
Example
thai_utils = self.env["thai.utils"]
# Convert Arabic to Thai numerals
thai_number = thai_utils.to_thai_number("1234567890") # → ๑๒๓๔๕๖๗๘๙๐
# Convert Thai to Arabic numerals
arabic_number = thai_utils.to_arabic_number("๐๘๙") # → 089
# Get Thai full month name
month_name = thai_utils.thai_month_name(12) # → ธันวาคม
# Get Thai abbreviated month name
month_abbr = thai_utils.thai_month_name(12, short=True) # → ธ.ค.
# Format date to Thai date string
from datetime import date
formatted_date = thai_utils.format_thai_date(date(2025, 7, 2)) # → 2 กรกฎาคม 2568
formatted_date_short_month = thai_utils.format_thai_date(date(2025, 7, 2), month_format="short") # → 2 ก.ค. 2568
formatted_date_numeric_month = thai_utils.format_thai_date(date(2025, 7, 2), month_format="numeric", format_date="{day:02d}{month}{year}") # → 02072568
formatted_year_thai = thai_utils.format_thai_date(date(2025, 7, 2), format_date="{year}") # → 2568
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
Credits
Contributors
Saran Lim. <saranl@ecosoft.co.th>
Tharathip Chaweewongphan <tharathipc@ecosoft.co.th>
Amin Cheloh <amincheloh@gmail.com>
Maintainers
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
Current maintainer:
This module is part of the OCA/l10n-thailand project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file odoo_addon_l10n_th_base_utils-18.0.3.0.0-py3-none-any.whl.
File metadata
- Download URL: odoo_addon_l10n_th_base_utils-18.0.3.0.0-py3-none-any.whl
- Upload date:
- Size: 3.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c060d2b334c8bddd9988e3e261fa84e0ffb1c8678dfe0eb41537b0707ae659cc
|
|
| MD5 |
a48563c5c95aefed3e178a959f5a7756
|
|
| BLAKE2b-256 |
0cb90f25515e47d02bf8b77cf67cab6a876e42df0cc2f5259c1227496fd06b43
|