Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 07-09-2022, 01:54 PM   #1
Wiggo
Leftutti
Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.
 
Wiggo's Avatar
 
Posts: 549
Karma: 1717097
Join Date: Feb 2019
Location: Bavaria
Device: iPad Pro, Kobo Libra 2
Custom column fails after switching language

It's not a problem for me I only noticed that switching calibre's language causes problems.

My native language is german and switching to english doesn't translate ja/yes, nein/no in the template.
Attached Thumbnails
Click image for larger version

Name:	Screenshot 2022-07-09 193851.jpg
Views:	99
Size:	65.6 KB
ID:	194833  
Wiggo is offline   Reply With Quote
Old 07-09-2022, 03:05 PM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,405
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Wiggo View Post
It's not a problem for me I only noticed that switching calibre's language causes problems.

My native language is german and switching to english doesn't translate ja/yes, nein/no in the template.
No it doesn't, and it never will. Working out what requires auto-translation in a template is a nightmare.

In this case you can use the check_yes_no() function. It doesn't depend on language.
Code:
{:'if check_yes_no('#read', 1, 1, 0) then 'Nicht Gelesen' else 'Gelesen' fi'}
You could also use a column "Text but with a fixed set of permitted values" with "Show Checkmarks" checked. In this case calibre knows to look at translations to choose the checkmark icon but the values remain unchanged for the template.
chaley is offline   Reply With Quote
Advert
Old 07-09-2022, 04:40 PM   #3
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,207
Karma: 1419197
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Aren't translators supposed not to translate such strings?
thiago.eec is offline   Reply With Quote
Old 07-09-2022, 05:01 PM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,405
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by thiago.eec View Post
Aren't translators supposed not to translate such strings?
I don't understand. Translators won't see strings in user-defined templates, so there is no opportunity to make the choice.

Templates operate on displayed (formatted) values. For something like a Yes/No column, calibre displays the translated value for the column. You probably would see the same for "Unknown" in authors & titles. That is one reason the check_yes_no() function was added -- to remove dependency on displayed values for yes/no columns in a template. But your question did remind me of another workaround. The template could use raw_field() to get an untranslated value ('true', 'false', 'none'), as in
Code:
{:'switch($$#read, 'true', 'Gelesen', 'false', 'Nicht Gelesen', 'Nicht Gelesen')'}
You might see similar problems with localized dates. If the date display format contains string days or months then the template will see them translated. If one is not careful then the locale order can also be a problem, where the template must know about mm/dd and dd/mm. The template writer can work around this by formatting the raw value and checking that.
chaley is offline   Reply With Quote
Old 07-09-2022, 11:22 PM   #5
Wiggo
Leftutti
Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.
 
Wiggo's Avatar
 
Posts: 549
Karma: 1717097
Join Date: Feb 2019
Location: Bavaria
Device: iPad Pro, Kobo Libra 2
I thought it would be a translation nightmare.
I'll try out your suggestions later for future proof

Thanks as always, chaley.
I want to stress again how great it is that you always help us out.
Wiggo is offline   Reply With Quote
Advert
Old 07-10-2022, 06:58 AM   #6
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,207
Karma: 1419197
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by chaley View Post
I don't understand. Translators won't see strings in user-defined templates, so there is no opportunity to make the choice.

Templates operate on displayed (formatted) values.
Sorry, I didn't know that. I was under the impression that words like "true", "false", "none", "yes", "no", "or", "and", etc, should always remain untranslated on the template. I looked at my templates and they all use raw_filed values. That's why I had that in my mind.

Also, there is really nothing to do with translators.
thiago.eec is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using RE to extract pattern from custom column into another custom column activedirectory Library Management 1 12-15-2019 08:07 PM
Sony book sorting by author fails when creating collections from a custom column speakingtohe Devices 2 05-15-2014 01:27 PM
Custom column returns value based on value of another custom column? calvin-c Calibre 3 09-14-2013 02:24 PM
Custom column listing the tags and language dpierron Library Management 4 10-19-2012 07:24 AM
Switching the language on firmware 1.4.00.23260 pupeno Sony Reader 15 06-17-2009 04:58 PM


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


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