hanja
hanja copied to clipboard
Consolidate mode, string_format parameters
It is possible to specify a translation mode when calling translate()
.
hanja.translate('大韓民國은 民主共和國이다.', 'substitution')
hanja.translate('大韓民國은 民主共和國이다.', 'combination-text')
It is also possible to provide a custom translation mode by supplying format_string
parameter.
hanja.translate('大韓民國은 民主共和國이다.', 'combination-text', format_string='{hanja} {hangul}')
In such cases, the mode
parameter does not serve any purposes.
I would like to revise translate()
so it only takes format_string
parameter, and we provide pre-defined format strings for existing translation modes (substitution
, combination-text
, combination-html
). It will look like this:
hanja.translate('大韓民國은 民主共和國이다.', Mode.substitution)
hanja.translate('大韓民國은 民主共和國이다.', Mode.combination_text)
hanja.translate('大韓民國은 民主共和國이다.', '{hanja} <{hangul}>')