library(rpkgkit)
dir <- file.path(tempdir(), "example")
usethis::create_package(dir, open = FALSE)
usethis::local_project(dir)
usethis::use_readme_md(open = FALSE)Manage README translations
use_multilanguage_readme() creates translation
placeholders below inst/translations/ and prints Markdown
badges that link to them.
use_multilanguage_readme(path = dir)This will help you plan a good structure for multilingual README files.
Badge management
Insert badge strings into README
badge_to_readme() inserts one Markdown badge into the
block delimited by <!-- badges: start --> and
<!-- badges: end -->. When both README files exist,
it updates README.Rmd rather than the generated
README.md.
Usually you can adds a badge generated by badger +
badge_to_readme()
badger::badge_code_size() |>
badge_to_readme()A badge may also be supplied directly as a single Markdown string:
badge_to_readme(
"[](https://example.com)",
path = dir
)
readLines("README.md") |> cli::cli_code()If the exact badge is already present, the function leaves the file unchanged.
Badge for AI-translated README files
badge_translated_by_ai() prints a badge and disclosure
statement for AI-translated README files.
badge_translated_by_ai("es")
#> ☐ Consider copying the following statement to the AI-translated file(s):
#>
#>
#> []()
#>
#>
#>
#> > Este contenido ha sido traducido por IA y no ha sido revisado. No es la lengua materna del autor y es solo para referencia.