Appsilon/shiny.i18n

Allow translating vectors

Closed this issue · 4 comments

It would improve the usage a lot if we could pass vectors of keys to the translator.
An example:

i18n$t(c("key1", "key2"))

could return:

[1] "Key one" "Key two"

Is this still open?? I just did this i18n$t(c("Result", "Ability")) and it worked!

I retract my comment. It basically works, unless all strings are availble. This part is the source of the trouble:

if (is.na(tr)){
        warning(sprintf("'%s' translation does not exist.", keyword))
        tr <- keyword
      }

If we change this to:

if (anyNA(tr)) ...

it won't be pretty (because the warning could not be formatted nicer) but it would work.

Thanks @SigurdJanson for suggestion. Indeed it should be easy this way, formatting warning shouldn't be a big issue. I'll try to include it soon.

@SigurdJanson it should be working now.