Version 0.1
transltr
0.1.0
CRAN release: 2025-02-14
Breaking Changes
- The package’s lifecycle is set back to
experimental
.- All features are still well tested and documented, but they may change again in a near future. I am thinking about introducing many small changes to the interface of classes
Text
andTranslator
.
- All features are still well tested and documented, but they may change again in a near future. I am thinking about introducing many small changes to the interface of classes
- R
>= 4.3.0
is now required. This is necessary to- leverage native
UTF-8
support on Windows, - use function shorthands (
\(...)
) and - use the native pipe operator
|>
and related placeholders_
.
- leverage native
- Package
stringi
is now required at runtime.- This package dramatically increases the performance of
normalize()
. - Its usage within the package will gradually increase over time.
- This package dramatically increases the performance of
- Option
transltr.default.path
is renamed totransltr.path
. -
constant()
is removed. While it technically was an unexported function, it was used to pass default values to many function arguments. -
find_source()
loses argumentstrict
. It is replaced by new argumentinterface
. -
as_text.call()
loses argumentsstrict
andvalidate
following the newinterface
mechanism offind_source()
. It was rewritten accordingly. -
translate()
is removed and replaced by the newinterface
mechanism offind_source()
. See the documentation of the latter for more information.
New Features
-
find_source()
now detects calls to methodTranslator$translate()
by default. Users may change this default behavior by passing a custom interface (a wrapper function) tofind_source()
. Since this work on a lexical basis, the function does not have to be defined at the timefind_source()
is called.- Users may migrate to the new mechanism by binding deprecated symbol
translate
to a function that calls methodTranslator$translate()
in the environment of their choice (where it fits).
- Users may migrate to the new mechanism by binding deprecated symbol
- New option
transltr.verbose
. It can be used to set allverbose
arguments to eitherTRUE
orFALSE
. - New function
normalize()
. The latter used to be internal but it is now exported for convenience. It documents how strings are standardized. - New method
Translator$set_default_value()
. It controls what methodsTranslator$translate()
andTranslator$get_translation()
return when there is no translation. - Documentation of
find_source()
and classTranslator
is now more thorough. - Many details were added to the package’s documentation overall. It was also simplified whenever appropriate.
Bug Fixes
-
export.Text()
andexport_translations()
now wrap lines longer than 80 characters automatically via new internal functionstr_wrap()
.- Consequently, so does
serialize()
andserialize_translations()
.
- Consequently, so does
-
normalize()
now handles edge cases appropriately thanks tostringi
. -
format.Text()
andformat.Translator()
now escape newline characters. - Identifiers of serialized
Location
objects embedded into serializedText
objects are now much shorter. -
find_source()
uses relative paths (to the project’s working directory) by default.
Notes
- The official title of the package (as it appears in
DESCRIPTION
) is now Support Many Languages in R. - The package now has a
pkgdown
website. See https://transltr.ununoctium.dev. It is not yet complete and requires more work. - A lot of typos were corrected here and there in the documentation.
- Comments included in Translator and translations files were updated.
- In outputs,
Source Text
is now used (it used to be pluralized). - The source code was (lightly) tidied.