MichaelChirico / potools

Tools for working with translations in R
https://michaelchirico.github.io/potools/
58 stars 2 forks source link

Implement po_create()/po_update() for creating/updating translations #235

Closed hadley closed 3 years ago

hadley commented 3 years ago

I don't love the name tr_add(), and it's making me doubt that the developer/translator distinction is that useful, because this function might be run by the developer or an R-packages savvy translator.

I tweaked the .Rproj to make my usual roxygen2 workflow a little smoother; let me know if you want to revert.

I'm little surprised that potools doesn't already use msginit, so maybe I should instead copy the approach used in translate_package()?

hadley commented 3 years ago

Changed it to add or update, depending on whether or not the .po file already exists. That makes tr_add() and even worse name.

hadley commented 3 years ago

I think this is better as po_create() and po_update(). I think po_update() should update all languages if none supplied; but that needs code from #234, so I'll wait until you've have a chance to review that.

MichaelChirico commented 3 years ago

I'm little surprised that potools doesn't already use msginit

There are a couple of gettext tools I would do well to integrate better with / provide good wrappers for...

codecov-commenter commented 3 years ago

Codecov Report

Merging #235 (a088663) into master (d68b90b) will decrease coverage by 1.51%. The diff coverage is 22.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #235      +/-   ##
==========================================
- Coverage   98.80%   97.29%   -1.52%     
==========================================
  Files          17       17              
  Lines        1341     1367      +26     
==========================================
+ Hits         1325     1330       +5     
- Misses         16       37      +21     
Impacted Files Coverage Δ
R/msgmerge.R 58.20% <22.22%> (-24.72%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d68b90b...a088663. Read the comment docs.

hadley commented 3 years ago

Ok, reimplemented basically from scratch; I'll add a bunch of tests shortly.

MichaelChirico commented 3 years ago

Looking great, thanks!