diff --git a/pyproject.toml b/pyproject.toml index 6dd85b8..fbbdc9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "i21y" -version = "0.1.0.post1" +version = "0.1.1" description = "The library for i18n support." authors = ["Takagi Tasuku "] license = "MIT" diff --git a/src/i21y/__init__.py b/src/i21y/__init__.py index 1c1cc07..9f58bd9 100644 --- a/src/i21y/__init__.py +++ b/src/i21y/__init__.py @@ -1,7 +1,7 @@ "tasuren - i21y" __author__ = "Takagi Tasuku" -__version__ = "0.1.0.post1" +__version__ = "0.1.1" __all__ = ("Translator", "I21YError", "TranslationNotFound", "locale_str") from .translator import Translator diff --git a/src/i21y/utils.py b/src/i21y/utils.py index 6a740e1..7983804 100644 --- a/src/i21y/utils.py +++ b/src/i21y/utils.py @@ -66,24 +66,26 @@ def join_raw(self, *other: str | locale_str) -> str: @overload def join( self: ..., *other: str | locale_str, - cls: type[AdtnlClsT] = None + cls: type[AdtnlClsT] = None, **extras: Any ) -> AdtnlClsT: ... @overload def join( self: SelfT, *other: str | locale_str, - cls: None = None + cls: None = None, **extras: Any ) -> SelfT: ... def join( self: SelfT, *other: str | locale_str, - cls: type[AdtnlClsT] | None = None + cls: type[AdtnlClsT] | None = None, **extras: Any ) -> SelfT | AdtnlClsT: """A version of :meth:`locale_str.join_raw` that returns the instance of the class that self. Args: - *other: Target strings.""" + *other: Target strings. + cls: The :class:`.locale_str` used to create the instance. + **extras: The value to pass to the ``extras`` argument of the constructor of :class:`.locale_str`.""" cls = cls or self.__class__ # type: ignore assert cls is not None - return cls(self.join_raw(*other)) + return cls(self.join_raw(*other), **extras) def __truediv__(self: SelfT, other: LocaleStr | Iterable[LocaleStr]) -> SelfT: if isinstance(other, str | locale_str): diff --git a/tests/test_locale_str.py b/tests/test_locale_str.py index 66d430a..bf72ade 100644 --- a/tests/test_locale_str.py +++ b/tests/test_locale_str.py @@ -11,4 +11,6 @@ assert str(LEFT) == str(RIGHT) assert LEFT.test == RIGHT.test -assert BASE // "kakikukeko" == "aiueo.kakikukeko" \ No newline at end of file +assert BASE // "kakikukeko" == "aiueo.kakikukeko" + +assert BASE.join("test", a="b").extras["a"] == "b" \ No newline at end of file