# SPDX-FileCopyrightText: 2024 Marco Ricci <software@the13thletter.info>
#
# SPDX-Licence-Identifier: MIT
"""Internal module. Do not use. Contains error strings and functions."""
from __future__ import annotations
import enum
import gettext
import inspect
import types
from typing import TYPE_CHECKING, NamedTuple
import derivepassphrase as dpp
if TYPE_CHECKING:
from collections.abc import Iterable, Mapping
from typing_extensions import Any, Self
__author__ = dpp.__author__
__version__ = dpp.__version__
__all__ = ('PROG_NAME',)
PROG_NAME = 'derivepassphrase'
translation = gettext.translation(PROG_NAME, fallback=True)
class TranslatableString(NamedTuple):
singular: str
plural: str
l10n_context: str
translator_comments: str
flags: frozenset[str]
def _prepare_translatable(
msg: str,
comments: str = '',
context: str = '',
plural_msg: str = '',
*,
flags: Iterable[str] = (),
) -> TranslatableString:
msg = inspect.cleandoc(msg)
plural_msg = inspect.cleandoc(plural_msg)
context = context.strip()
comments = inspect.cleandoc(comments)
flags = (