Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 09-07-2014, 05:35 AM   #1
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,220
Karma: 11044355
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Braces in strings

I have a string in my plugin which looks like this:

Code:
<span %(code)s>@{@</span> and <span %(code)s>@}@</span>
but when I try to translate it in transifex (just replace "and" with "y"), I get this error:

Error: The expression '{@ y @}' is not present in the original phrase.

Why is this happening? there are other strings with literal { and } which are not affected. Is there any way to avoid this (other than moving @{@ and @}@ out of the translatable string)?
Jellby is offline   Reply With Quote
Old 09-07-2014, 07:58 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 37,331
Karma: 16448187
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Transifex will be performing checks to ensure that replacement placeholders are not altered, presumably those checks are being confounded by that type of placeholder.
kovidgoyal is offline   Reply With Quote
Advert
Old 09-08-2014, 08:48 AM   #3
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,220
Karma: 11044355
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Transifex support suggested that I could disable placeholder checks, which I can't because I have no management rights, and anyway I don't think I'd want to do that.

But given that in the main calibre file there are other strings with similar content (the eval(template) description, for instance), could you check if there is any difference in the settings between that and the plugin? Maybe they have different source formats or something?
Jellby is offline   Reply With Quote
Old 09-08-2014, 09:04 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 37,331
Karma: 16448187
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I haven't customized any placeholder related settings on any of the files either in main calibre or in the plugins.

The problem is simply that the transifex checking code is recognizing

{@</span> and <span %(code)s>@}

as a placeholder. Translations should never alter the content inside placeholders, so it is complaining. I suspect the checking code use a simple regext of something like {\S+.+} to recognize these. The eval() function docstring has a space after the { which is why it doesn't trigger the problems.

If this is the only string where you have a problem simply special case it, make it something like

val = _('<span %(code)s>{}</span> and <span %(code)s>{}</span>').format('@{@', '@}@')
kovidgoyal is offline   Reply With Quote
Old 09-08-2014, 01:10 PM   #5
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,220
Karma: 11044355
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by kovidgoyal View Post
The eval() function docstring has a space after the { which is why it doesn't trigger the problems.
Yes, that may be.

Quote:
If this is the only string where you have a problem simply special case it, make it something like

val = _('<span %(code)s>{}</span> and <span %(code)s>{}</span>').format('@{@', '@}@')
That was my plan B, yes. But first I wanted to make sure what happening and why. Thanks.
Jellby is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't concat strings: NoClassDefFoundError indeed Kindle Developer's Corner 6 09-03-2013 02:03 PM
All strings must be XML compatible? talzag Conversion 1 04-10-2013 09:39 AM
How to exclude strings before and after ElMiko Sigil 14 07-21-2012 06:34 PM
What are these strings for? Jellby Calibre 2 05-22-2011 01:08 PM
Belt & Braces & Backups Bricorn Amazon Kindle 3 02-07-2011 04:03 PM


All times are GMT -4. The time now is 02:12 PM.


MobileRead.com is a privately owned, operated and funded community.