Skip to content
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

handle multiline messages ids #2

Merged
merged 1 commit into from
May 9, 2022
Merged

handle multiline messages ids #2

merged 1 commit into from
May 9, 2022

Conversation

omar-polo
Copy link
Contributor

@omar-polo omar-polo commented Sep 10, 2020

Hi,

I found that multiline message ids aren't handled correctly. Let's say we have a translation string like this:

(tr "Info:\nUsername: %s\nBrowser: %s\nLocation: %s" ,,,)

then the PO file will be something like:

#: src/foo/example.clj
msgid "Info:
Username: %s
Browser: %s
Location: %s"
msgstr ""

and that's not the correct syntax AFAIK. In fact, poedit truncates the msg id to "Info". The correct output should be

#: src/foo/example.clj
msgid ""
"Info:\n"
"Username: %s\n"
"Browser: %s\n"
"Location: %s"
msgstr ""

So, this PR is my take on this problem: with this I am able to export multiline translation strings as POT file, translate 'em with poedit and parse the resulting PO file back with pottery.

I'll be the first to say that fmt-msg-id is a terrible name for a function, but I'm not too inspired tonight, apologies. Also, the choice to use cl-format may be too brave but, while the format string seems some sort of line noise, I fear that any more verbose alternative would require the same mental effort. Anyway, I don't have strong feelings towards cl-format, so I can change that eventually.

@lockie
Copy link

lockie commented May 5, 2022

@yannvanhalewyn @aabelmann Hey guys, sorry to bother, but would you mind merging this PR? I'm absolutely loving how nice and simple pottery is, but I'm affected by this multiline strings problem as well.

@stefanroex
Copy link
Member

@lockie Ah, we've completely overlooked this PR. I'll have a look at it in a few days and release a new version. Until then, you're maybe able to use a git dependency on the branch in you deps.edn?

@lockie
Copy link

lockie commented May 5, 2022

@stefanroex Thank you! Sure, I'm not in a big hurry 😊

@stefanroex stefanroex merged commit 5788c93 into brightin:master May 9, 2022
@omar-polo
Copy link
Contributor Author

thanks :)

@stefanroex
Copy link
Member

stefanroex commented May 9, 2022

@omar-polo Sorry it took so long. It wasn't on my radar at all 😅! I've started watching all activity on this repo now. Just released 0.0.5 to Clojars.

@omar-polo
Copy link
Contributor Author

don't worry! and thanks for the library :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants