Open eliocamp opened 3 years ago
Thanks for the first external issue report!
I'm a bit torn on this one... the current behavior is designed around how base R does things, e.g.
By your suggestion, the path would have to be src/Srunmed.c
.
The situation for base is even worse, where the .pot file is at $R_DEVEL/src/library/base/po/*.pot
and the source references there are relative to $R_DEVEL
.
Is there an option to set the relative directory for poedit, or to run poedit from inside the R directory to begin with?
If not, I can try to think of an option that would either let the user pick a directory relative to which the paths are given, or more simplistically to toggle paths to be relative to the dir
argument.
I will also try and find some other projects & see what they've done on this front. We might be better tailoring to how .pot files are usually handled & even file a bug with R to get them to conform to that if there seems to be a consensus.
(PS, note that base R doesn't provide any source markers in the R-*.pot files, so I'm glad we're seeing some payoff already to my efforts to include them!)
FIRST! :woman_dancing: :
Is it different between C files and R files? I'm looking at here, for example, and source files paths are written relative to the root directory.
#: src/appl/optim.c:60
msgid "non-finite value supplied by 'optim'"
msgstr "nicht endlicher Wert von 'optim' übergeben"
I don't know how poedit figures out the root directory, though, but with these files, I can just double click on them and it automatically works. I tried to to the same with the file you highlighted and poedit didn't find the source file, though.
EDIT: After looking at other files, it seems that base is the only package that writes source files relative to root. All the others I've looked at have just the name. Seems to be because the files listed on base are outside the base folder.
yep the base case is unique -- base includes the files in po/POTFILES (that po is TLD of r-devel).
and yes, R & C sides are different using the base R tooling because gettext doesn't have direct support for R -- instead R has tools::xgettext2pot() for writing (very minimalist) .pot files.
potools tries to eliminate the divergence of the two
Would something like #194 be a good backup here?
I can relatively easily run
rstudioapi::sourceMarkers()
Which we can click through to the source. I'm still not sure how exactly to use that/combine it with the interactive translation workflow but it's there...
That would work only during interactive translation in potools, but it won't solve any issues with other tooling, if understand correctly?
right... lateral progress :)
That would work wonderfully for correcting problematic strings, I think.
I'm starting to use this package. I created the .pot file to my package and I noticed that the way it writes source file locations is not compatible with poedit.
For instance if a string is in R/Derivate.R, the generated .pot looks like this:
If I open the file on poedit and right click on the string, it cannot open the sour cefile. If I change it to this, however:
Now it works.