-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export po_compile() #234
Export po_compile() #234
Conversation
This function was previously called `update_mo_files()`. I don't know if `dev_compile()` is better, but I like the idea of using prefixes to distinguish between functions for developers and translators. Let me know if you have a better name, or if you'd prefer me to leave as is. I also made a few changes to make it more user friendly: it now discovers the package name (if needed), and can lazily recompile just the files that have changed. I also tweaked the messaging so you get one message per translation (which makes it easier to see what the msgfmt messages apply to). Two questions: * Is my scoped use of roxygen2 ok? (roxygen2 is designed to work like this so there's no chance of it clobbering your hand written files) * Do you want me to add tests? If so, I'd probably start by refactoring the code to extract out a data frame (data table?) that contains the po path, mo_path, and language.
Renamed to |
Yep that's perfect. I was just wondering (and hoping) if roxygen could work for incrementally migrating like that. |
Codecov Report
@@ Coverage Diff @@
## master #234 +/- ##
==========================================
- Coverage 98.81% 98.24% -0.57%
==========================================
Files 17 18 +1
Lines 1351 1371 +20
==========================================
+ Hits 1335 1347 +12
- Misses 16 24 +8
Continue to review full report at Codecov.
|
feels less muddled for describing the output (which involves .mo files)
Tests would be ideal. Caveat that the testthat setup for the package is a bit messy, it could probably go for some improvement... don't get stuck on that, would rather merge first & do tests as a follow-up if that's becoming a blocker. |
Added you as a collaborator to facilitate: https://github.com/MichaelChirico/potools/invitations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll work on adding some tests too
* Hoist lazy up into po_compile() * Use lang-regexp for filtering files * Record po type
Ok, I think this should be good to go for now, assuming you're ok with a withr dep for the tests. I've only added one test for now, since testing compilation requires some easy way to create a |
|
(not sure how to reply to a comment on a thread in "outdated" code so cc-ing to PR thread)
I am not sure... my guess is to avoid encoding problems. Not sure if it's just to avoid the headache or if there's a deeper issue. The wording in the R docs is a bit vague (from
There's also this page from the R site: https://developer.r-project.org/Translations30.html
And here's how it happens in i.e., "in a UTF-8 locale" means |
I'm thinking about backing off on the idea of supporting |
for interface consistency you might just duplicate ngettext (tr_n = ngettext) |
Conflicts: DESCRIPTION R/utils.R
Should be good to merge now; definitely needs more tests but I think they'll be easier to add as the other pieces start to fall in place. |
Thanks a bunch Hadley! Don't let me forget to add you as a co-author (running out of steam for the night) |
I'm happy to add myself. Do you mind if I also switch to Authors@R? |
yep, the only reason I didn't just go ahead & add you is I wanted to switch |
This function was previously called
update_mo_files()
. I don't know ifdev_compile()
is better, but I like the idea of using prefixes to distinguish between functions for developers and translators. Let me know if you have a better name, or if you'd prefer me to leave as is.I also made a few changes to make it more user friendly since it's now exported: it discovers the package name (if needed), and can lazily recompile just the files that have changed. I also tweaked the messaging so you get one message per translation (which makes it easier to see what the
msgfmt
messages apply to).Two questions:
Is my scoped use of roxygen2 ok? (roxygen2 is designed to work like this so there's no chance of it clobbering your hand written files)
Do you want me to add tests? If so, I'd probably start by refactoring the code to extract out a data frame (data table?) that contains the po path, mo_path, and language.