1 | | - _"Namespaces are one honking great idea -- let's do more of those!"_ |
2 | | - The Java docs say on [Naming a Package](https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html): _"Companies use their reversed Internet domain name to begin their package names"_ |
3 | | - The name should serve both _semantic_ and _accountability purposes_, i.e. we should be able to guess what it does, and how I can check it's legit. |
4 | | - [Dependency confusion](https://www.activestate.com/resources/quick-reads/dependency-confusion/) is a thing. |
5 | | - For Apache Maven in the Java world, _"The group ID should resemble the package name, or reverse DNS of your web site"_ is a requirement to be listen in the [Maven Central repository](https://repo.maven.apache.org/maven2/) |
6 | | - For Luna LMS that's easy: `luna.text.html.ar_SY` |
7 | | - But for 3rd parties, if we follow Java's style, how do we know where the domain ends? `ext.org.example.user.audio.opus.fa_IR` |
8 | | - The check would happen over some [well-known URI](https://www.iana.org/assignments/well-known-uris/well-known-uris.xhtml), similar to DKIM. We could try from the most specific subdomain: stripping `ext`, then `fa_IR.opus.audio.user.example.org` -> `opus.audio.user.example.org` -> `audio.user.example.org` -> `user.example.org` -> `example.org` , until one of them succeeds. |
9 | | - Finally, what about metadata? The variant type needs a readable name, probably a description etc. |
10 | | - **A variant definition is part of the code, not of the data.** |
11 | | - So: no definitions, code, metadata etc. on the _variant type and specification_ should lurk in the course database, in a local folder like icons etc. |
12 | | - Instead, it should be provided at the code level, in a folder where Python can load it. |
13 | | - That way, again similar to Java, the type name can become the path: `import ext.org.example.user` , which would imply a `ext/org/example/user/__init__.py` |
14 | | - This module can then register itself with a `type`, a localised `name` (or, in Dublin Core, an `identifier`), and a `description` |
| 1 | [[https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classicu_1_1Locale.html#a0638620f0b0c25aad55539f14f739244|icu::Locale Class Reference: minimizeSubtags()]] |
| 2 | |
| 3 | {{{ |
| 4 | >>> import icu |
| 5 | >>> icu.Locale.create |
| 6 | icu.Locale.createCanonical( icu.Locale.createFromName( icu.Locale.createKeywords( icu.Locale.createUnicodeKeywords( |
| 7 | >>> icu.Locale.createFromName("de_DE") |
| 8 | <Locale: de_DE> |
| 9 | >>> str(icu.Locale.createFromName("de_DE")) |
| 10 | 'de_DE' |
| 11 | >>> str(icu.Locale.createFromName("de")) |
| 12 | 'de' |
| 13 | >>> icu.Locale.createCanonical("de_DE") |
| 14 | <Locale: de_DE> |
| 15 | >>> str(icu.Locale.createCanonical("de_DE")) |
| 16 | 'de_DE' |
| 17 | >>> str(icu.Locale.createCanonical("de")) |
| 18 | 'de' |
| 19 | >>> str(icu.Locale.createCanonical("fa_IR")) |
| 20 | 'fa_IR' |
| 21 | >>> str(icu.Locale.createCanonical("fa-IR")) |
| 22 | 'fa_IR' |
| 23 | >>> str(icu.Locale.createFromName("de")) |
| 24 | 'de' |
| 25 | >>> str(icu.Locale.createFromName("de").minimizeSubtags()) |
| 26 | 'de' |
| 27 | >>> str(icu.Locale.createFromName("de_DE").minimizeSubtags()) |
| 28 | 'de' |
| 29 | >>> str(icu.Locale.createFromName("en-US").minimizeSubtags()) |
| 30 | 'en' |
| 31 | }}} |