[X] I agree to follow this project's Contributing Guidelines.
Description
It's often necessary to dynamically render values in the UI:
tags$div(glue::glue("Your model has {accuracy} accuracy"))
With present implementation, this must be parsed into two translation strings:
tags$div(tags$span(i18n$t("Your model has "), accuracy, i18n$t(" accuracy")))
Problem
This can grow to be extremely cumbersome the more dynamic substitution is necessary. Reflexive verbs and prepositions often need special treatment relative to the sentence subject in other languages so sentence fragments may have the same key in english, but multiple keys in other languages, further complicating implementation.
Proposed Solution
The key lookup logic could use regex lookup flags IE the key might look like:
"Your model has $x/\\d+\\.\\d+\\%/ accuracy"
which would leave the regex as is while replacing the language around it. I guess this also could be complicated depending on changes to sentence structure in other languages, but c'est la vie.
Guidelines
Description
It's often necessary to dynamically render values in the UI:
tags$div(glue::glue("Your model has {accuracy} accuracy"))
With present implementation, this must be parsed into two translation strings:Problem
This can grow to be extremely cumbersome the more dynamic substitution is necessary. Reflexive verbs and prepositions often need special treatment relative to the sentence subject in other languages so sentence fragments may have the same key in english, but multiple keys in other languages, further complicating implementation.
Proposed Solution
The key lookup logic could use regex lookup flags IE the key might look like:
which would leave the regex as is while replacing the language around it. I guess this also could be complicated depending on changes to sentence structure in other languages, but c'est la vie.
Alternatives Considered
Not really, it's a complex problem to solve.