09-07-2014, 05:35 AM | #1 |
frumious Bandersnatch
Posts: 7,516
Karma: 19000001
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> 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)? |
09-07-2014, 07:58 AM | #2 |
creator of calibre
Posts: 44,008
Karma: 22669822
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.
|
Advert | |
|
09-08-2014, 08:48 AM | #3 |
frumious Bandersnatch
Posts: 7,516
Karma: 19000001
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? |
09-08-2014, 09:04 AM | #4 |
creator of calibre
Posts: 44,008
Karma: 22669822
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('@{@', '@}@') |
09-08-2014, 01:10 PM | #5 | ||
frumious Bandersnatch
Posts: 7,516
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Quote:
|
||
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
All strings must be XML compatible? | talzag | Conversion | 2 | 02-19-2021 02:28 PM |
Can't concat strings: NoClassDefFoundError | indeed | Kindle Developer's Corner | 6 | 09-03-2013 02:03 PM |
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 |