To format dates in the full month name format : [Month Name] [YEAR] I use:
format(Sys.Date(),"%B %Y")
Now , I would do the same thing but in arabic:
## save locals
loc <- Sys.getlocale("LC_TIME")
Sys.setlocale("LC_TIME","Arabic")
format(Sys.Date(),"%B %Y")
## "????? 2015" ## <----should have "جويلية 2015"
## restore locales
Sys.setlocale("LC_TIME",loc)
Arabic months are not replaced by "????". I don't think it is a print/Unicode problem since arabic is displayed correctly in the console:
"مرحبا "
[1] "مرحبا "
Internally strptime
is called for formatting, from ?strptime
:
Locale-specific conversions to and from character strings are used where appropriate and available
I think strptime
don't have the right translation in arabic language. If this is true where can I contribute to fix this?
edit
AS pointed in comments This seems like it could be a system/OS problem specific. indeed , under Ubuntu machine , installing language-pack-ar and calling
Sys.setlocale("LC_TIME", "ar_AE.utf8");
format(Sys.Date(),"%B %Y")
[1] "يوليو 2015"
gives the right answer.
But under Windows , turning the locale to Arabic ( settings panel -> region..) and calling the same code of the question don't resolve the problem.