Skip to content

Consolidate mode, string_format parameters #9

@suminb

Description

@suminb

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}>')

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions