[R-pkg-devel] translation .mo files

2020-02-08 Thread Paul Gilbert
I have been sent .po and .mo files with message translations for one of 
my packages. The .po file I know goes in the source package po/ 
directory but I have not had .mo files previously. The translator thinks 
the .mo file goes in inst/po. The .mo file seems to be generated from 
the .po file, but I am not sure if that happens in the install of the 
source package, or in some pre-process. I thought I could determine this 
by looking at an installed package, but I don't see .po or .mo files in 
installed packages. So far I have had no luck finding documentation on 
these details. So I have three questions.


-Should the .mo file be included in the package, and if so, where?

-When a package is installed, where does the translation information go 
in the directory structure of the library?


-Is this documented somewhere? (Please not a vague reference to 'Writing 
R Extensions', I've looked there and many other places. I need a section 
or page reference.)


Thanks,
Paul Gilbert

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] translation .mo files

2020-02-08 Thread Thomas J. Leeper
Hi Paul,

Check out this doc file for suggested workflows:
https://stat.ethz.ch/R-manual/R-devel/library/tools/html/update_pkg_po.html

The key part is that you need to create a .pot file from which the .po
files are generated and edit. Then you need to "install" the
translations (before R CMD build) to get them in the right place. I
wouldn't recommend trying to do any of that by hand.

I once wrote a more convenient version of all of this (no longer on
CRAN) that might be helpful. See, especially this file:
https://github.com/RL10N/msgtools/blob/master/R/install_translations.R.
That package also contains translations so you can see an example of
where everything should end up.

Best,
-Thomas

Thomas J. Leeper

On Sat, Feb 8, 2020 at 11:05 AM  wrote:

> Date: Sat, 8 Feb 2020 03:14:54 -0500
> From: Paul Gilbert 
> To: r-package-devel@r-project.org
> Subject: [R-pkg-devel] translation .mo files
> Message-ID: <053184fa-8caa-e09a-603f-9bd37cc23...@gmail.com>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> I have been sent .po and .mo files with message translations for one of
> my packages. The .po file I know goes in the source package po/
> directory but I have not had .mo files previously. The translator thinks
> the .mo file goes in inst/po. The .mo file seems to be generated from
> the .po file, but I am not sure if that happens in the install of the
> source package, or in some pre-process. I thought I could determine this
> by looking at an installed package, but I don't see .po or .mo files in
> installed packages. So far I have had no luck finding documentation on
> these details. So I have three questions.
>
> -Should the .mo file be included in the package, and if so, where?
>
> -When a package is installed, where does the translation information go
> in the directory structure of the library?
>
> -Is this documented somewhere? (Please not a vague reference to 'Writing
> R Extensions', I've looked there and many other places. I need a section
> or page reference.)
>
> Thanks,
> Paul Gilbert
>

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] "found non-ASCII strings" with save(version = 2)

2020-02-08 Thread Vincent Arel-Bundock
Unsurprisingly, this was due to user error. I found the fix.

Sorry for the email clutter.

vab

On Wed, Feb 5, 2020, at 08:32, Vincent Arel-Bundock wrote:
> Hi everyone,
> 
> My `countrycode` package ships with two data frames of characters in 
> several languages: codelist and codelist_panel.
> 
> I converted all strings to UTF-8 using the `enc2utf8` function, but I 
> also tried several other ways, with the stringi package, etc. As far as 
> I can tell, the strings are all in UTF-8 format now:
> 
> url <- 
> 'https://github.com/vincentarelbundock/countrycode/raw/master/data/codelist.rda'
> temp <- tempfile()
> download.file(url, temp)
> load(temp)
> tmp <- codelist[, sapply(codelist, is.character)]
> library(stringi)
> all(unlist(lapply(tmp, function(x) stri_enc_isutf8((na.omit(x))
> [1] TRUE
> 
> After encoding, I saved the data frames with this command:
> 
> save(codelist, file = 'data/codelist.rda', compress = 'xz', version = 2)
> 
> Yet, when I run R CMD check, I get the following warning:
> 
> checking data for non-ASCII characters ... WARNING
> Warning: found non-ASCII strings
> 'Wrtemberg' in object 'codelist'
> 'So Tom and Prncipe' in object 'codelist'
> 'Wrtemberg' in object 'codelist_panel'
> 'So Tom and Prncipe' in object 'codelist_panel'
> 
> This warning disappears if I save the data frames using `save(version = 
> 3)`. However, I would prefer to use version 2 to keep compatibility 
> with older versions of R.
> 
> Does anyone have suggestions for how to handle this? What did I miss?
> 
> Thanks a lot for your time!
> 
> Vincent
> 
> --
> Vincent Arel-Bundock
> 
> Professeur agrégé / Associate professor
> http://arelbundock.com
> Université de Montréal, Science politique
> 3150 rue Jean-Brillant, Pav. Lionel-Groulx, C-4020
> Montréal, Québec, Canada, H3T 1N8

-- 
Vincent Arel-Bundock

Professeur agrégé / Associate professor
http://arelbundock.com
Université de Montréal, Science politique
3150 rue Jean-Brillant, Pav. Lionel-Groulx, C-4020
Montréal, Québec, Canada, H3T 1N8

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] CRAN RPM repositories available

2020-02-08 Thread Iñaki Ucar
Hi all,

I apologize if you are receiving multiple copies of this email, but
I'm cross-posting because I believe this may be of interest to a wider
audience than just R-SIG-Fedora.

This is to announce that I'm maintaining a Copr project [1] that
provides RPM repos for Fedora 30, 31 and rawhide for most of CRAN
(currently, almost 15k packages), and they are automatically
synchronized with CRAN (removing archived packages and building new
updates) on a daily basis.

Please, feel free to use them. For further details, see the overview
page [1]. Bug reports and feedback are more than welcome [2].

[1] https://copr.fedorainfracloud.org/coprs/iucar/cran
[2] https://github.com/Enchufa2/cran2copr/issues

Regards,
-- 
Iñaki Úcar

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel