mquinson / po4a

Maintain the translations of your documentation with ease (PO for anything)
http://po4a.org/
GNU General Public License v2.0
121 stars 58 forks source link

How to escape spaces in the name of (master) files #412

Closed christian-wolf-eks closed 1 year ago

christian-wolf-eks commented 1 year ago

I want to create a config file to be used in an existing project. The folder structure contains paths with spaces in them. I tried to escape but do fail to get results.

[type: text] "content/en/docs/Getting Started/_index.md" $lang:"content/$lang/docs/Getting Started/_index.md"

I also tried with and without the quotes and escaping the space with \. No success.

I think this should be documented (if intentionally not supported) or fixed to accept spaces in the file names.

PS: I remember that I had once a space in the parent folder. There was some issue with the call to msgmerge as the parameters were not escaped accordingly as well. This might be a follow up issue.

mquinson commented 1 year ago

Hello,

I tried implementing something along these lines over the weekend, but it proved somewhat difficult. I'll try to finish it, but I cannot give any ETA on this.

mquinson commented 1 year ago

Ok, I got something working, I guess. It will only work with po4a main script, not with the obsolete po4a-* subscripts.

You can now either quote the file names, or escape the spaces (but not both in the same filename).

HTH,

Glandos commented 9 months ago

I've got the following configuration:

[po_directory] doc/po/

[options] opt:"--master-charset='UTF-8'" opt:"--localized-charset='UTF-8'" opt:"--msgmerge-opt='--no-wrap'" opt:"--wrap-po=newlines" opt:"--keep 0"

[po4a_alias:markdown] text opt:"--option markdown" opt:"--option neverwrap"
[type: markdown] CHANGELOG.md $lang:doc/$lang/CHANGELOG.md

And the output with the patch from https://github.com/mquinson/po4a/commit/b3fbb7f61c47d108411f1fd66e2c3926737508e4:

> po4a doc/po4a.conf
Double quote (") matched with simple quote (') at /usr/bin/po4a line 880, <CONFIG> line 3.

I thought it would be OK to use single-quote within double quotes?

Glandos commented 9 months ago

Hmmm I think I'm missing other parts… I will wait for the next release before a real test, sorry if this was a noisy comment.