Skip to content

Commit

Permalink
Arabic locale suppoty
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxscout committed Sep 13, 2024
1 parent 6807849 commit 931ea79
Show file tree
Hide file tree
Showing 82 changed files with 28,728 additions and 7 deletions.
9 changes: 9 additions & 0 deletions CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ Patches and Suggestions
- Florian Kroiß `(Wooza)`_
- Han Wang `(freddiewanah)`_
- David Gorup `(CerealKiller0807)`_
- Taha Zerrouki `(linuxscout)`_
- Yahia Abdeldjallil Benamrouche `(yah04dev)`_
- Watheq Alshowaiter `(watheqAlshowaiter)`_
- Zayed Alsaidi `(zayedalsaidi)`_


.. _(lk-geimfari): https://github.com/lk-geimfari
Expand Down Expand Up @@ -164,3 +168,8 @@ Patches and Suggestions
.. _(Wooza): https://github.com/Wooza
.. _(freddiewanah): https://github.com/freddiewanah
.. _(CerealKiller0807): https://github.com/CerealKiller0807
.. _(zayedalsaidi): https://github.com/zayedalsaidi
.. _(linuxscout): https://github.com/linuxscout
.. _(watheqAlshowaiter): https://github.com/watheqAlshowaiter
.. _(yah04dev): https://github.com/yah04dev

1 change: 1 addition & 0 deletions ar
8 changes: 7 additions & 1 deletion docs/locales.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ countries.
======= ======= ==================== ==================== ====================
Country Code Associated attribute Name Native Name
======= ======= ==================== ==================== ====================
🇦🇪 `ar-ae` **Locale.AR_AE** Arabic U.A.E العربية
🇩🇿 `ar-dz` **Locale.AR_DZ** Arabic Algeria العربية
🇪🇬 `ar-eg` **Locale.AR_EG** Arabic Egypt العربية
🇯🇴 `ar-jo` **Locale.AR_JO** Arabic Jordan العربية
🇴🇲 `ar-om` **Locale.AR_OM** Arabic Oman العربية
🇸🇾 `ar-sy` **Locale.AR_SY** Arabic Syria العربية
🇾🇪 `ar-ye` **Locale.AR_YE** Arabic Yemen العربية
🇨🇿 `cs` **Locale.CS** Czech Česky
🇩🇰 `da` **Locale.DA** Danish Dansk
🇩🇪 `de` **Locale.DE** German Deutsch
Expand Down Expand Up @@ -128,4 +135,3 @@ Country Code Associated attribute Name Native Name
🇺🇦 `uk` **Locale.UK** Ukrainian Українська
🇨🇳 `zh` **Locale.ZH** Chinese 汉语
======= ======= ==================== ==================== ====================

105 changes: 105 additions & 0 deletions mimesis/datasets/ar-ae/Arabic-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
## How to Add a New Locale

** To build an arabic locale dataset **

* Follow the following template, and the "How to add a new locale",
* There are many common parts
* Make changes in some parts of data:
* datetime: months
* address: localize to your country
* Finance: to be localized.
* Person: universities, surnames
* food: dishes

This is a template of the dataset directory structure for a specific locale.

There are seven JSON files (`File name`) that contain data related to various data providers (`Provider`):

* `address.json` - Address()
* `builtin.json` - YourSpecProvider()
* `datetime.json` - Datetime()
* `finance.json` - Finance()
* `food.json` - Food()
* `person.json` - Person()
* `text.json` - Text()

## Steps to Follow Before Submitting a Pull Request for Adding Support for a New Locale:

1. Copy the folder from `locale_template` to `your-locale-code`.
2. Ensure that you have replaced all `["Tests""]` sections with data specific to your locale.
3. Remove all `"__COMMENT_KEY__": "Description"` from the JSON files. This data is only for developers.
4. Add your locale to the `mimesis.enums.Locale` class.
5. Format the content of JSON files alphabetically using a tool like [jsoneditoronline.org](http://jsoneditoronline.org).
6. If your locale uses a shortened address format, add your locale code to `SHORTENED_ADDRESS_FMT` in `mimesis/datasets/int/address.py`.
7. Make sure you have added the currency symbol for your locale to `CURRENCY_SYMBOLS` in `mimesis/datasets/int/finance.py`.
8. Ensure that you have added your locale code to `ISBN_GROUPS` in `mimesis/datasets/int/code.py`.
9. Run tests and confirm that all tests pass successfully.
10. Add yourself as a contributor in `CONTRIBUTORS.md`.

#### You can grab code of your locale from the table below:

| | | | |
|-------|--------------------------------|-------|--------------------------|
| af | Afrikaans | sq | Albanian |
| ar-sa | Arabic (Saudi Arabia) | ar-iq | Arabic (Iraq) |
| ar-eg | Arabic (Egypt) | ar-ly | Arabic (Libya) |
| ar-dz | Arabic (Algeria) | ar-ma | Arabic (Morocco) |
| ar-tn | Arabic (Tunisia) | ar-om | Arabic (Oman) |
| ar-ye | Arabic (Yemen) | ar-sy | Arabic (Syria) |
| ar-jo | Arabic (Jordan) | ar-lb | Arabic (Lebanon) |
| ar-kw | Arabic (Kuwait) | ar-ae | Arabic (U.A.E.) |
| ar-bh | Arabic (Bahrain) | ar-qa | Arabic (Qatar) |
| eu | Basque (Basque) | bg | Bulgarian |
| be | Belarusian | ca | Catalan |
| zh-tw | Chinese (Taiwan) | zh-cn | Chinese (PRC) |
| zh-hk | Chinese (Hong Kong SAR) | zh-sg | Chinese (Singapore) |
| hr | Croatian | cs | Czech |
| da | Danish | nl | Dutch (Standard) |
| nl-be | Dutch (Belgium) | en | English |
| en-us | English (United States) | en-gb | English (United Kingdom) |
| en-au | English (Australia) | en-ca | English (Canada) |
| en-nz | English (New Zealand) | en-ie | English (Ireland) |
| en-za | English (South Africa) | en-jm | English (Jamaica) |
| en | English (Caribbean) | en-bz | English (Belize) |
| en-tt | English (Trinidad) | et | Estonian |
| fo | Faeroese | fa | Farsi |
| fi | Finnish | fr | French (Standard) |
| fr-be | French (Belgium) | fr-ca | French (Canada) |
| fr-ch | French (Switzerland) | fr-lu | French (Luxembourg) |
| gd | Gaelic (Scotland) | ga | Irish |
| de | German (Standard) | de-ch | German (Switzerland) |
| de-at | German (Austria) | de-lu | German (Luxembourg) |
| de-li | German (Liechtenstein) | el | Greek |
| he | Hebrew | hi | Hindi |
| hu | Hungarian | is | Icelandic |
| id | Indonesian | it | Italian (Standard) |
| it-ch | Italian (Switzerland) | ja | Japanese |
| ko | Korean | ko | Korean (Johab) |
| lv | Latvian | lt | Lithuanian |
| mk | Macedonian (FYROM) | ms | Malaysian |
| mt | Maltese | no | Norwegian (Bokmal) |
| no | Norwegian (Nynorsk) | pl | Polish |
| pt-br | Portuguese (Brazil) | pt | Portuguese (Portugal) |
| rm | Rhaeto-Romanic | ro | Romanian |
| ro-mo | Romanian (Republic of Moldova) | ru | Russian |
| ru-mo | Russian (Republic of Moldova) | sz | Sami (Lappish) |
| sr | Serbian (Cyrillic) | sr | Serbian (Latin) |
| sk | Slovak | sl | Slovenian |
| sb | Sorbian | es | Spanish (Spain) |
| es-mx | Spanish (Mexico) | es-gt | Spanish (Guatemala) |
| es-cr | Spanish (Costa Rica) | es-pa | Spanish (Panama) |
| es-do | Spanish (Dominican Republic) | es-ve | Spanish (Venezuela) |
| es-co | Spanish (Colombia) | es-pe | Spanish (Peru) |
| es-ar | Spanish (Argentina) | es-ec | Spanish (Ecuador) |
| es-cl | Spanish (Chile) | es-uy | Spanish (Uruguay) |
| es-py | Spanish (Paraguay) | es-bo | Spanish (Bolivia) |
| es-sv | Spanish (El Salvador) | es-hn | Spanish (Honduras) |
| es-ni | Spanish (Nicaragua) | es-pr | Spanish (Puerto Rico) |
| sx | Sutu | sv | Swedish |
| sv-fi | Swedish (Finland) | th | Thai |
| ts | Tsonga | tn | Tswana |
| tr | Turkish | uk | Ukrainian |
| ur | Urdu | ve | Venda |
| vi | Vietnamese | xh | Xhosa |
| ji | Yiddish | zu | Zulu |

Loading

0 comments on commit 931ea79

Please sign in to comment.