from application.domain import (
    I18nImpl,
    I18n,
)
from application.repository.impl import (
    MwI18nRepository,
)

i18n_cache = {}


def get_i18n(
    pos_id,  # type: int
):
    # type: (...) -> I18n

    global i18n_cache
    if pos_id not in i18n_cache:
        i18n_cache[pos_id] = I18nImpl(MwI18nRepository(pos_id))
    return i18n_cache[pos_id]
