From: Philipp Reh Date: Sat, 1 Aug 2009 13:29:41 +0000 (+0200) Subject: Added translation of ー X-Git-Url: https://git.enpas.org/?p=jmdict-cli.git;a=commitdiff_plain;h=c1a24e9dc38e105d8b21ef132f7ec79b9d41f99d Added translation of ー --- diff --git a/kana2romaji.cpp b/kana2romaji.cpp index 17c9aea..646e47c 100644 --- a/kana2romaji.cpp +++ b/kana2romaji.cpp @@ -331,6 +331,8 @@ void initRomaji() { romaji["−"] = "-"; romaji["―"] = "-"; romaji[" "] = " "; + + romaji["ー"] = "\3"; } void remove_quote_1( @@ -359,7 +361,7 @@ void kana2romaji(const string& kana, string& rom) { if (trans == romaji.end()) { rom += ch; if (ch.size() > 1) - cout << "Don't know how to translate '" << ch << "' in '" << kana << "' to romaji." << endl; + cout << "Don't know how to translate '" << ch << "' in '" << kana << "' to romaji.\n"; } else rom += trans->second; @@ -431,4 +433,15 @@ void kana2romaji(const string& kana, string& rom) { --pos; } } + else if (rom[pos] == '\3') + { + if(pos == 0) + { + cout << "ー is the first letter of a word. Don't know how to translate this.\n"; + rom.erase(pos); + --pos; + } + else + rom[pos] = rom[pos-1]; + } }