diff options
author | Max Staudt <max@enpas.org> | 2021-12-28 03:21:47 +0100 |
---|---|---|
committer | norly <ny-git@enpas.org> | 2021-12-28 03:38:20 +0100 |
commit | afb81937a7df686f63cebaecfbc9e736f34f3608 (patch) | |
tree | 16add2e4c2dabbdec7ef47028f77f69051a985de /jmdict.cpp | |
parent | a71285e3792f3c7326f3503275128e5aac180896 (diff) |
Interpret Latin input as both Romaji and Englishfixes-2021
This allows jmdict to be fed any input and autodetecting the intended
translation direction, similar to Sumatora on Android.
Whether English, Romaji, Kana, or Kanji - it will simply do The Right
Thing To Do(TM):
UTF8 input -> Japanese->English
Non-UTF8 input -> Romaji->English, plus English->Japanese
Diffstat (limited to 'jmdict.cpp')
-rw-r--r-- | jmdict.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -161,7 +161,8 @@ void guessLanguage(const std::string& subject) { if (options::source == options::JAPANESE && !isUTF8) options::source = options::JAPANESE_ROMAJI; else if (options::source == options::UNKNOWN) - options::source = isUTF8 ? options::JAPANESE : options::NOT_JAPANESE; + // options::source = isUTF8 ? options::JAPANESE : options::NOT_JAPANESE; + options::source = isUTF8 ? options::JAPANESE : options::UNKNOWN; } int main(int argc, char** argv) @@ -180,8 +181,12 @@ try { fromJapanese(subject); else if (options::source == options::JAPANESE_ROMAJI) fromRomaji(subject); - else + else if (options::source == options::NOT_JAPANESE) + toJapanese(subject); + else { + fromRomaji(subject); toJapanese(subject); + } cout << entries << " match(es) found." << endl; return EXIT_SUCCESS; |