For the translation part, you can test the received error message against the translated message. You can get the translated version from the original one using gettext("<non-translated error message exactly as the original code does it>").
This should be agile to user's language settings but, of course, not to changes that the developer does to the the error message. Henrik On Dec 2, 2017 05:38, "Bill Denney" <b...@denney.ws> wrote: Hi, I got a message last night that some of the tests in the PKNCA package do not follow best practices. ("Do not test the exact format of R messages (from R itself or from other packages): They change, and they can be translated.") Specifically, I test to ensure that an error is generated when a class cannot be coerced into a data.frame: https://cran.r-project.org/web/checks/check_results_PKNCA.html I want to ensure that I'm getting an error that the variable cannot be coerced into a data.frame. What is the best practice to ensure that I'm getting a specific R error (about coercion) without testing the formatting of the error text? The only solution that immediately occurs to me is to wrap the coercion in a tryCatch and give my own error. But, then were the R error translated, the users of my package would lose the benefit of translation. Thanks, Bill ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel [[alternative HTML version deleted]] ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel