GithubHelp home page GithubHelp logo

Comments (5)

JimmXinu avatar JimmXinu commented on June 21, 2024 2

For future reference: The reason a en.mo file doesn't work is because of a Calibre optimization to explicitly assume English is the coded language and never needs translation.

From: https://github.com/kovidgoyal/calibre/blob/v6.29.0/src/calibre/customize/zipplugin.py#L118

        from calibre.utils.localization import get_lang
        lang = get_lang()
        if not lang or lang == 'en':  # performance optimization
            _translations_cache[zfp] = None
            return

Which would also prevent explicit unique string keys, so at least I don't feel bad about not going that anymore.

Knowing this, I could provide my own implementation of load_translations() or otherwise work around it and then correct English language strings in a en.mo.

But IMO, it's inevitable that I (or someone else) would eventually try to change some previously 'corrected' string in code and be baffled for hours why it doesn't work, not remembering (or never knowing) about the en.po/mo override.

So I am closing this, but at least it's documented. I also added a comment in the code by the typo.

from fanficfare.

JimmXinu avatar JimmXinu commented on June 21, 2024

I acknowledge that's a typo.

But by my understanding of transifex.com, fixing it will invalidate the 11 existing translations into other languages for that string. I'm not sure it's worth fixing in that case.

from fanficfare.

Mandabar avatar Mandabar commented on June 21, 2024

It's just a minor typo, and at least it's the right sound so it's easy enough to understand what it's supposed to be. And it's rarely even seen, I've been using this plugin for forever and I can't remember seeing it before. Though realistically I should have and probably just glazed over it.

If you say it's going to break the translations then, it's your decision, but I just leave it as is then I guess. I didn't even think of the translations but I would have thought it would have just left them incorrect not broken. Oh well, tried to help!

from fanficfare.

JimmXinu avatar JimmXinu commented on June 21, 2024

The translation system uses the original English string as the key into the translated files. Example.

If I had taken the time to give each string a unique key and make a separate English translation file, we probably wouldn't have this problem. But there's 500+ strings and I couldn't be bothered to retrofit all that.

I don't know if I even could now. Just adding a en.mo file doesn't override the coded value.

from fanficfare.

Mandabar avatar Mandabar commented on June 21, 2024

Interesting to know, thanks! Yeah it's going to probably have to stay that way then. Almost sounds like those horror stories of code where you change one thing and 40 other things break.

Thanks for the thought taken into this. 👍

(Should I be hitting to close button as the opener, or you as the dev?)

from fanficfare.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.