Skip to content

Commit

Permalink
Translating to Japanese
Browse files Browse the repository at this point in the history
  • Loading branch information
Mercury13 committed Dec 19, 2024
1 parent 1e5d540 commit c6437be
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 25 deletions.
6 changes: 5 additions & 1 deletion Lang-src/en/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@
</trigger-langs>
<!-- Alphabetical sorting, right now very simple and locale-independent
non-meaning stub of alphabet = underscore _
alp follow="1" (see Russian) — this alphabet is not parallel;
instead it will be greater than everything we have defined
(to split long strings, reduce # of underscores, better sync long alphabets)
Limitations:
• Difference within first 40 MEANING chars of term/block, otherwise they are deemed equal
• Strings that differ with “equal” character only are forbidden:
äbb < abc < äbd is supported, but abc < äbc isn’t.
• 32-bit chars ALLOWED
• Max alphabet 32K
• Sum of all alphabets following each other 32K
• Alphabet with follow=1 MAY contain text (though better not for beauty)
• # if alphabets unlimited -->
<alpha-sort>
<alp>ABCDEFGHIJKLMNOPQRSTUVWXYZ</alp>
Expand Down
61 changes: 49 additions & 12 deletions Lang-src/ja/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,59 @@
<trigger-langs>
<lang iso="ja" />
</trigger-langs>
<!-- Alphabetical sorting, right now very simple and locale-independent
non-meaning stub of alphabet = underscore _
Limitations:
• Difference within first 40 MEANING chars of term/block, otherwise they are deemed equal
• Strings that differ with “equal” character only are forbidden:
äbb < abc < äbd is supported, but abc < äbc isn’t.
• 32-bit chars ALLOWED
• Max alphabet 32K
• # if alphabets unlimited -->
<alpha-sort>
<alp>あいうえぉお</alp><!-- Vowel -->
<alp>アイウエォオ</alp>
<alp follow="1" /><!-- K/G -->
<alp>かがきぎくぐけげこご</alp>
<alp>カガキギクグケゲコゴ</alp>
<alp follow="1" /><!-- S/Z -->
<alp>さざしじすずせぜそぞ</alp>
<alp>サザシジスズセゼソゾ</alp>
<alp follow="1" /><!-- T/D -->
<alp>っただちぢつづてでとど</alp>
<alp>ッタダチヂツヅテデトド</alp>
<alp follow="1" /><!-- N -->
<alp>なにぬねの</alp>
<alp>ナニヌネノ</alp>
<alp follow="1" /><!-- H/B/P -->
<alp>はばぱひびぴふぶぷへべぺほぼぽ</alp>
<alp>ハバパヒビピフブプヘベペホボポ</alp>
<alp follow="1" /><!-- M -->
<alp>まみむめも</alp>
<alp>マミムメモ</alp>
<alp follow="1" /><!-- Y -->
<alp>ゃやゆよ</alp>
<alp>ャヤユヨ</alp>
<alp follow="1" /><!-- R -->
<alp>らラりリるルれレろロ</alp>
<alp follow="1" /><!-- W -->
<alp>ゎわゐゑを</alp>
<alp>ヮワヰヱヲ</alp>
<alp follow="1" /><!-- Consonant/V -->
<alp>ん__ゔ</alp>
<alp>ンヷヸヴヹヺ</alp>
<alp>ABCDEFGHIJKLMNOPQRSTUVWXYZ</alp>
<alp>abcdefghijklmnopqrstuvwxyz</alp>
<alp>____________________Ü_____</alp>
<alp>____________________ü_____</alp>
</alpha-sort>
<alpha-fixup />
<alpha-fixup>
<!-- For Japanese: they are just conversions to kana -->
<blk start="1980" target="しん たい゠ ろ もじ (ふぃんらんどご)" /><!-- Talu -->
<blk start="1D00" target="おんせい きごう かくちょう" />
<blk start="1D80" target="おんせい きごう かくちょう ほそく" />
<blk start="20A0" target="つうか きごう" />
<blk start="2100" target="もじ さま きごう" />
<blk start="2150" target="すうじ けいしき" />
<blk start="2190" target="やじるし" /><!-- the rest arrows will automatically pull -->
<blk start="2200" target="すうがく きごう" /><!-- the rest math will automatically pull -->
<blk start="2F00" target="かん ぶしゅ" /><!-- Kangxi, the 2nd will automatically pull -->
<blk start="3100" target="ちゅう おと じぼ (たま かげ)" /><!-- Bopo -->
<blk start="103A0" target="こだい ぺるしゃ もじ" /><!-- Xpeo -->
<blk start="10840" target="ていこく あらむ もじ" /><!-- Imperial Aramaic -->
<blk start="10C00" target="もじ (ほご-じぇねしす) (るーんご)" /><!-- Orkh -->
<blk start="10F70" target="こだい ういぐる もじ" /><!-- Ougr -->
<blk start="11580" target="しったん もじ (ぼんじ)" /><!-- Sidd -->
</alpha-fixup>
<!-- For discoverability some auxiliary blocks are placed next to “parent” ones,
breaking alphabet order and referenceability.
These blocks are marked with ellipsis. -->
Expand Down
9 changes: 6 additions & 3 deletions Lang-src/ru/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
</trigger-langs>
<alpha-sort>
<!-- Dash is for Yi: «И — слоги» < «Иврит» -->
<alp>—АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯABCDEFGHIJKLMNOPQRSTUVWXYZ</alp>
<alp>_абвгдеёжзийклмнопрстуфхцчшщъыьэюяabcdefghijklmnopqrstuvwxyz</alp>
<alp>_á____é_________ó___________________________________________</alp>
<alp>—АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ</alp>
<alp>_абвгдеёжзийклмнопрстуфхцчшщъыьэюя</alp>
<alp>_á____é_________ó_________________</alp>
<alp follow="1" />
<alp>ABCDEFGHIJKLMNOPQRSTUVWXYZ</alp>
<alp>abcdefghijklmnopqrstuvwxyz</alp>
</alpha-sort>
<alpha-fixup />
<ellipsis text="">
Expand Down
11 changes: 7 additions & 4 deletions Lang-src/uk/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
<lang iso="uk" />
</trigger-langs>
<alpha-sort>
<alp>АБВГДЕЄЖЗИІЇЙКЛМНОПРСТУФХЦЧШЩЬЮЯABCDEFGHIJKLMNOPQRSTUVWXYZ</alp>
<alp>абвгдеєжзиіїйклмнопрстуфхцчшщьюяabcdefghijklmnopqrstuvwxyz</alp>
<alp>á__ґ_é____í______ó________________________________________</alp>
<alp>___Ґ______________________________________________________</alp>
<alp>АБВГДЕЄЖЗИІЇЙКЛМНОПРСТУФХЦЧШЩЬЮЯ</alp>
<alp>абвгдеєжзиіїйклмнопрстуфхцчшщьюя</alp>
<alp>á__ґ_é____í______ó______________</alp>
<alp>___Ґ____________________________</alp>
<alp follow="1" />
<alp>ABCDEFGHIJKLMNOPQRSTUVWXYZ</alp>
<alp>abcdefghijklmnopqrstuvwxyz</alp>
</alpha-sort>
<alpha-fixup />
<ellipsis text="">
Expand Down
11 changes: 9 additions & 2 deletions Unicodia/LocList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,18 @@ namespace {

r.sortOrder.clear();
auto hAlphaSort = hLocale.child("alpha-sort");
int base = 0, greatest = -1;
for (auto& v : hAlphaSort.children("alp")) {
if (v.attribute("follow").as_bool(false)) {
base = greatest + 1;
}
auto alph = mojibake::toS<std::u32string>(v.text().as_string());
for (size_t i = 0; i < alph.length(); ++i) {
if (auto c = alph[i]; c != '_')
r.sortOrder[c] = i;
if (auto c = alph[i]; c != '_') {
int newCode = base + i;
r.sortOrder[c] = newCode;
greatest = std::max(greatest, newCode);
}
}
}

Expand Down
8 changes: 7 additions & 1 deletion Unicodia/Uc/UcData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1636,10 +1636,16 @@ void uc::finishTranslation(
std::u8string_view keyName = blk.loc.name;
if (blk.alphaKey.ecScript != EcScript::NONE) {
keyName = script.loc.name;
if (script.mainBlock)
if (script.mainBlock) {
if (auto q = alphaFixup.find(script.mainBlock->startingCp); q != alphaFixup.end()) {
buildSortKey(q->second, SpecialSort::NO, sortOrder, blk.loc.sortKey);
goto alreadyBuilt;
}
keyName = script.mainBlock->loc.name;
}
}
buildSortKey(keyName, SpecialSort::NO, sortOrder, blk.loc.sortKey);
alreadyBuilt: ;
}
}

Expand Down
4 changes: 2 additions & 2 deletions Unicodia/Uc/UcData.h
Original file line number Diff line number Diff line change
Expand Up @@ -766,10 +766,10 @@ namespace uc {

DEFINE_ENUM_OPS(Bfg)

enum class MyName { INST };
enum class MyName : unsigned char { INST };

///
/// \brief The BlockAlpha struct
/// Use someone’s else name for sorting
///
struct AlphaKey {
EcScript ecScript = EcScript::NONE;
Expand Down

0 comments on commit c6437be

Please sign in to comment.