
Convert date to yearmon format with localized month names
Source:R/translations.R
translate_yearmon.RdThis function converts a date to yearmon format (Month Year) with the month name displayed in the specified language.
Arguments
- date
A date object or character string that can be converted to a date
- language
A two-letter language code. Available options:
"fr" - French
"en" - English
"es" - Spanish
"de" - German
"it" - Italian
"pt" - Portuguese
"ru" - Russian
"zh" - Chinese
"ja" - Japanese
"ko" - Korean
"ar" - Arabic
"hi" - Hindi
- format
Format string for the output. Default is "%b %Y" for abbreviated month name and year. Use "%B %Y" for full month name.
Examples
translate_yearmon(Sys.Date(), "en")
#> Warning: Locale NA not available. Using system default.
#> [1] "Jun 2026"
translate_yearmon(Sys.Date(), "fr")
#> Warning: Locale NA not available. Using system default.
#> [1] "Jun 2026"
translate_yearmon(Sys.Date(), "fr", format = "%B %Y")
#> Warning: Locale NA not available. Using system default.
#> [1] "June 2026"