Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
markdown file xgettext + gettext #92
base: main
Are you sure you want to change the base?
markdown file xgettext + gettext #92
Changes from all commits
58ef255
1585bb4
c34397f
cae3d3b
d8549cc
493a4f4
ba6f9a0
5e81e3b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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'm a bit in doubt about the best command line interface for this...
One idea would be to allow
which would translate
foo.md
usingxx.po
and write the output tofoo-xx.md
.Here,
foo.md
could be left out or it could be-
and then we read fromstdin
(like formarkdown-xgettext
below). Similar,-o
can be left out or be-
and then we write tostdout
.If there are multiple inputs, then I guess the user cannot write to
stdout
and must instead give an output directory:In this case it would be an error to attempt to read from
stdin
since we don't really know what to name the output file in that case.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.
If I'm understanding correctly, we want optional flags for output file title and directory.
Since
markdown-gettext xx.po foo.md -o foo-xx.md
, does this mean if one was to add an additional wef.md, would the command be:markdown-gettext xx.po foo.md wef.md -o foo-xx.md wef-xx.md
?Output directory makes sense to me 👍. I would just like some clarification on file naming conventions, especially when one wants to translate multiple files.
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.
Yeah, I'm trying to figure out how we can model the behavior here to be similar to existing Unix commands.
We should also keep it simple! Less code for all of us to write and maintain 😄
I'm thinking of using
cp
as a basis:cp
can copy a single path to a new name orcp
can copy multiple path into a single directoryThe paths which are copied can be files or directories (or a mix of both). If there is a directory, then you must add
-r
to do a recursive copy.I now see
as
but with the translation happening as well.
Similarly,
as
Finally, the rule out
-r
should be implemented: if you want to recursively translate a directory, you have to add a-r
flag.This new thinking is different from what I had before where I thought we should use the flags from the GNU Gettext utilities. Back then, I hadn't realized that there isn't a command line program which mirrors what our
markdown-gettext
program will do 😄Note that these are just ideas, please let me know if you have better ones!
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.
@mgeisler I'll write up a doc that outlines what the CLI should do for both
xgettext
andgettext
. Once we get everything to your liking, I'll change the binaries to follow those requirements!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.
Sounds great! That document could simultaneously become the manual for the tools, so your work here will be reused right away.
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.
This is the writeup for
gettext
markdown-gettext
This tool copies source paths to destination paths while performing translations.
Usage
For a single file translation:
note for single file translations:
source.md
is not specified, the program reads fromstdin
dest.md
is not specified, the program outputs tostdout
For multiple paths:
For directories, you must use the
-r
flag for a recursive translation:Arguments
xx.po
.po
formatsource.md foo.md bar.txt sourcedir/
etc...dest.md, dest/
Options
-r
Please let me know what you think! @mgeisler @djmitche. I tried to be as simple as possible.
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.
Hey @friendlymatthew, sorry for the slow reply. The above looks great, thank you very much for writing it up! I think it follow the behavior from the
cp
manual page closely.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.
No worries @mgeisler, I appreciate the opportunity to work on this 😁.
When I have some time off from official work, I'll get on this ASAP