Skip to content

Commit 3263747

Browse files
committed
Created latin-locales pkg
1 parent 35ea667 commit 3263747

16 files changed

Lines changed: 679 additions & 0 deletions

File tree

latin-locales/docs/LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# 🏛️ MIT License
2+
3+
**Copyright © 2026 [Adam Lui](https://github.com/adamlui)**
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

latin-locales/docs/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# > latin-locales
2+
3+
<a href="https://github.com/adamlui/python-utils/releases/tag/latin-locales-1.0.0">
4+
<img height=31 src="https://img.shields.io/badge/Latest_Build-1.0.0-32fcee.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
5+
<a href="https://github.com/adamlui/python-utils/blob/main/latin-locales/docs/LICENSE.md">
6+
<img height=31 src="https://img.shields.io/badge/License-MIT-f99b27.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
7+
<a href="https://www.codefactor.io/repository/github/adamlui/python-utils">
8+
<img height=31 src="https://img.shields.io/codefactor/grade/github/adamlui/python-utils?label=Code+Quality&logo=codefactor&logoColor=white&labelColor=464646&color=a0fc55&style=for-the-badge"></a>
9+
<a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_python-utils">
10+
<img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_python-utils%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=fafc74"></a>
11+
12+
> ### _ISO 639-1 (2-letter) codes for Latin locales that don't require advanced Unicode support._
13+
14+
It's just a [JSON file](https://github.com/adamlui/python-utils/blob/latin-locales-1.0.0/latin-locales/src/latin_locales/latin_locales.json), so you can use it in any environment.
15+
16+
## Installation
17+
18+
```bash
19+
pip install latin-locales
20+
```
21+
22+
## Usage
23+
24+
```py
25+
import latin_locales
26+
27+
print(latin_locales)
28+
# => ['aa', 'ae', 'af', 'ak', 'an', 'ay', 'bi', 'bm', 'br', ...]
29+
```
30+
31+
_Note: Most type checkers will falsely warn_ `latin_locales` _is not iterable because they are incapable of analyzing runtime behavior (where the module is replaced w/ a list for cleaner, direct access). You can safely suppress such warnings using_ `# type: ignore`.
32+
33+
## MIT License
34+
35+
Copyright © 2026 [Adam Lui](https://github.com/adamlui).

latin-locales/noxfile.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
from pathlib import Path
2+
from types import SimpleNamespace as sn
3+
4+
import nox
5+
6+
pkg = sn(dir=Path(__file__).parent.name)
7+
pkg.name = pkg.dir.replace('-', '_')
8+
paths = sn(utils=sn(bump='utils/bump.py', clean='utils/clean.py', publish='utils/publish.sh'))
9+
10+
def session(func) : return nox.session(venv_backend='none')(func)
11+
12+
# SESSIONS
13+
14+
@session
15+
def dev(session) : session.run('pip', 'install', '-e', '.')
16+
17+
@session
18+
def bump_patch(session, no_push=True):
19+
cmd = ['py', paths.utils.bump, '--patch']
20+
if no_push : cmd.append('--no-push')
21+
session.run(*cmd, *session.posargs)
22+
@session
23+
def bump_minor(session, no_push=True):
24+
cmd = ['py', paths.utils.bump, '--minor']
25+
if no_push : cmd.append('--no-push')
26+
session.run(*cmd, *session.posargs)
27+
@session
28+
def bump_feat(session, no_push=True):
29+
bump_minor(session, no_push)
30+
@session
31+
def bump_major(session, no_push=True):
32+
cmd = ['py', paths.utils.bump, '--major']
33+
if no_push : cmd.append('--no-push')
34+
session.run(*cmd, *session.posargs)
35+
36+
@session
37+
def build(session) : clean(session) ; session.run('py', '-m', 'build') ; print('Build complete!')
38+
@session
39+
def publish(session) : session.run('bash', paths.utils.publish, *session.posargs)
40+
41+
@session
42+
def deploy_patch(session) : bump_patch(session, no_push=False) ; build(session) ; publish(session)
43+
@session
44+
def deploy_minor(session) : bump_minor(session, no_push=False) ; build(session) ; publish(session)
45+
@session
46+
def deploy_feat(session) : deploy_minor(session)
47+
@session
48+
def deploy_major(session) : bump_major(session, no_push=False) ; build(session) ; publish(session)
49+
50+
@session
51+
def clean(session) : session.run('py', paths.utils.clean)

latin-locales/pyproject.toml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
[build-system]
2+
requires = [
3+
"setuptools>=82.0.0,<83",
4+
"wheel",
5+
]
6+
build-backend = "setuptools.build_meta"
7+
8+
[project]
9+
name = "latin-locales"
10+
version = "1.0.0"
11+
description = "ISO 639-1 (2-letter) codes for Latin locales that don't require advanced Unicode support"
12+
authors = [
13+
{ name = "Adam Lui", email = "adam@kudoai.com" },
14+
]
15+
readme = "docs/README.md"
16+
license = "MIT"
17+
license-files = [
18+
"docs/LICENSE.md",
19+
]
20+
requires-python = ">=2.6,<4"
21+
keywords = [
22+
"charset",
23+
"detection",
24+
"i18n",
25+
"internationalization",
26+
"json",
27+
"language",
28+
"latin",
29+
"locale",
30+
"localization",
31+
"script",
32+
"unicode",
33+
]
34+
classifiers = [
35+
"Development Status :: 5 - Production/Stable",
36+
"Intended Audience :: Developers",
37+
"Intended Audience :: Information Technology",
38+
"Intended Audience :: Science/Research",
39+
"Natural Language :: English",
40+
"Operating System :: OS Independent",
41+
"Programming Language :: Python",
42+
"Programming Language :: Python :: 2",
43+
"Programming Language :: Python :: 2.6",
44+
"Programming Language :: Python :: 2.7",
45+
"Programming Language :: Python :: 3",
46+
"Programming Language :: Python :: 3.8",
47+
"Programming Language :: Python :: 3.9",
48+
"Programming Language :: Python :: 3.10",
49+
"Programming Language :: Python :: 3.11",
50+
"Programming Language :: Python :: 3.12",
51+
"Programming Language :: Python :: 3.13",
52+
"Programming Language :: Python :: 3.14",
53+
"Programming Language :: Python :: 3.15",
54+
"Topic :: Scientific/Engineering",
55+
"Topic :: Scientific/Engineering :: Information Analysis",
56+
"Topic :: Software Development",
57+
"Topic :: Software Development :: Libraries",
58+
"Topic :: Software Development :: Libraries :: Python Modules",
59+
"Topic :: Software Development :: Internationalization",
60+
"Topic :: Software Development :: Localization",
61+
"Topic :: Text Processing :: Linguistic",
62+
"Topic :: Utilities",
63+
]
64+
65+
[project.urls]
66+
Changelog = "https://github.com/adamlui/python-utils/releases/tag/latin-locales-1.0.0"
67+
Documentation = "https://github.com/adamlui/python-utils/tree/main/latin-locales/docs"
68+
Funding = "https://github.com/sponsors/adamlui"
69+
Homepage = "https://github.com/adamlui/python-utils/tree/main/latin-locales/#readme"
70+
Issues = "https://github.com/adamlui/python-utils/issues"
71+
"PyPI Stats" = "https://pepy.tech/projects/latin-locales"
72+
Releases = "https://github.com/adamlui/python-utils/releases"
73+
Repository = "https://github.com/adamlui/python-utils"
74+
75+
[project.optional-dependencies]
76+
dev = [
77+
"nox>=2026.2.9",
78+
"tomli>=2.0.0,<3",
79+
"tomli-w>=0.1.0,<2",
80+
]
81+
82+
[tool.setuptools.packages.find]
83+
where = ["src"]
84+
85+
[tool.setuptools.package-data]
86+
"latin_locales" = ["latin_locales.json"]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import json, os, sys
2+
3+
with open(os.path.join(os.path.dirname(__file__), 'latin_locales.json')) as file:
4+
latin_locales = json.load(file)
5+
6+
sys.modules[__name__] = latin_locales
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
[
2+
"aa",
3+
"ae",
4+
"af",
5+
"ak",
6+
"an",
7+
"ay",
8+
"bi",
9+
"bm",
10+
"br",
11+
"ca",
12+
"ch",
13+
"co",
14+
"cs",
15+
"cy",
16+
"da",
17+
"de",
18+
"ee",
19+
"en",
20+
"eo",
21+
"es",
22+
"et",
23+
"eu",
24+
"fi",
25+
"fj",
26+
"fo",
27+
"fr",
28+
"fy",
29+
"ga",
30+
"gd",
31+
"gl",
32+
"gn",
33+
"gv",
34+
"ha",
35+
"ho",
36+
"hr",
37+
"ht",
38+
"hu",
39+
"hz",
40+
"ia",
41+
"id",
42+
"ie",
43+
"ig",
44+
"ik",
45+
"io",
46+
"is",
47+
"it",
48+
"kg",
49+
"ki",
50+
"kj",
51+
"kl",
52+
"kr",
53+
"kw",
54+
"la",
55+
"lb",
56+
"lg",
57+
"li",
58+
"ln",
59+
"lt",
60+
"lu",
61+
"lv",
62+
"mg",
63+
"mh",
64+
"mi",
65+
"ms",
66+
"mt",
67+
"na",
68+
"nb",
69+
"nd",
70+
"ng",
71+
"nl",
72+
"nn",
73+
"no",
74+
"nr",
75+
"nv",
76+
"ny",
77+
"oc",
78+
"om",
79+
"pl",
80+
"pt",
81+
"qu",
82+
"rm",
83+
"rn",
84+
"ro",
85+
"rw",
86+
"sc",
87+
"se",
88+
"sg",
89+
"sk",
90+
"sl",
91+
"sm",
92+
"sn",
93+
"so",
94+
"sq",
95+
"ss",
96+
"st",
97+
"sv",
98+
"sw",
99+
"tl",
100+
"tn",
101+
"to",
102+
"tr",
103+
"ts",
104+
"tw",
105+
"ty",
106+
"ve",
107+
"vi",
108+
"vo",
109+
"wa",
110+
"wo",
111+
"xh",
112+
"yo",
113+
"za",
114+
"zu"
115+
]

0 commit comments

Comments
 (0)