This is a sample iOS app for converting Japanese text with kanji to hiragana, katakana, or Latin alphabet.
There are 3 options for converting text.
A JSON API to convert Japanese text with kanji to either hiragana or katakana.
An XML API to put ruby (furigana) over Japanese text with kanji. In this app it is used to convert text to either hiragana or Latin alphabet.
CFStringTokenizer
can be used to generate Latin transcription of Japanese text on device without using network.
From that, a String
transformation can be applied to get hiragana or katakana transliterations.
To use network APIs you must first register a developer account with Goo and Yahoo! Japan (both are in Japanese only) and obtain App IDs for each.
Then fill them in furigana-converter/secrets.xcconfig
.
Don't use quotation marks, e.g.:
GOO_APP_ID = 12345abcd
YAHOO_APP_ID = 12345abcd
This sample app can be improved in several ways.
-
Implement tests.
-
Introduce 3rd party frameworks to reduce complexity.
Stuff like Moya
or/and Alamofire
for network abstraction, RxSwift
for better state handling.
- Add new functionality.
- Copying the result to clipboard.
- Take full advantage of Yahoo API and surface different options to user, or show results as actual furigana.
- Put UI into table view and implement showing and managing history of requests.