Appsilon / shiny.i18n

Shiny applications internationalization made easy
https://appsilon.github.io/shiny.i18n/
Other
169 stars 38 forks source link

[Bug]: files created by `create_translation_file` not found when creating new translator #137

Open see24 opened 2 months ago

see24 commented 2 months ago

Guidelines

Project Version

0.3.0

Platform and OS Version

Windows 11

Existing Issues

No response

What happened?

The default output file name for create_translation_file and the RStudio addin for csv output is "translate_lang.csv" which I expected I would just need to add the language to eg "translate_fr.csv" and change the "key" in the first column to "en" and "lang" in the second column to "fr", fill in the translations and it would work. But I got an error that "Key translation is not the same in all files.". This was missleading since the keys were not part of the problem

Steps to reproduce

  1. Using the basic example app create_translation_file("examples/basic/app_csv.R", type = "csv")
  2. just change "lang" and "key" placeholders and add dummy translations then try to use it i18n <- Translator$new(translation_csvs_path = ".") Get error: "Key translation is not the same in all files."

Expected behavior

Two things should happen differently:

  1. Output from create_translation_file should be called "translation_lang.csv" so it is more obvious what the right file name is and so it matches json
  2. read_and_merge_csvs should have a check for length(all_files) == 0 and give an informative error that no files were found matching the pattern "translation_.*[.]csv" See this line

Attachments

No response

Screenshots or Videos

No response

Additional Information

No response