Git Product home page Git Product logo

Comments (15)

josevalim avatar josevalim commented on May 21, 2024

The question is: do we want to automatically copy it for all idioms? Or just for english? And which one is a better default even for other languages, showing no text or showing the text in english?

It feels copying msgstr for the merge is indeed the best way to go.

from gettext.

chrismccord avatar chrismccord commented on May 21, 2024

I was thinking only for English, otherwise you'll have stray english fragments to track down when you make changes

from gettext.

josevalim avatar josevalim commented on May 21, 2024

@chrismccord right. assuming you don't track those down, the website/app will show no text, which I think is worse even for non-english languages?

from gettext.

whatyouhide avatar whatyouhide commented on May 21, 2024

The idea would be to turn a .pot (with blank strings) into a .po only when you're ready to translate all of the strings in the language of the new .po.

@josevalim / @chrismccord Do you think people would use "" as a translation on purpose for some reason? If not, we could just make gettext see "" as untranslated strings, so that when it encounters one, it just returns the msgid. (I think I already proposed this a long time ago but we didn't think about it too much because it was a bit early in the life of gettext)

from gettext.

bryanenders avatar bryanenders commented on May 21, 2024

I like what @whatyouhide is proposing. It prevents the case of showing no text where no translation is yet provided, making it easy for a programmer to internationalize up front and defer localization. It also yields a translation file that a translator can more easily and intuitively complete (i.e., they don’t have to delete text or hunt for where they left off). It also facilitates piecemeal translation: it’s clear where translations are missing in the .po, those strings are empty.

from gettext.

bryanenders avatar bryanenders commented on May 21, 2024

Also, the tools for working with .po files expect that a blank msgstr is awaiting translation (not one whose text matches its msgid). The portable object format and its generation is pretty clearly defined. The parsing of those files is not. That’s where we can define new behaviour, such as translating msgstr "" to its msgid.

from gettext.

whatyouhide avatar whatyouhide commented on May 21, 2024

@endersstocker the parsing may not be clearly defined, but I wouldn't do things like msgstr :empty or turning msgstr "" into msgstr MSGID_HERE in the parser (a lot of tools support reading/writing PO files and I want to mess them up as little as possible).

What I was proposing was doing this at a higher level, in the l(n)gettext functions: when we try to find a translation for "foo" in locale "loc" but get back "", then we fallback to the value of the msgid.

from gettext.

bryanenders avatar bryanenders commented on May 21, 2024

@whatyouhide I’m with you. I meant parsing in a broader sense. I’m saying keep the .po generation the way it is; change how gettext handles an entry with msgstr "".

from gettext.

josevalim avatar josevalim commented on May 21, 2024

@whatyouhide just so I understand, do tools like poedit use things like msgstr "" to identify what needs to be translated? Couldn't use a comment for that (like we do with # fuzzy?

At first, replacing "" makes me feel a bit uncomfortable. But if we don't have another option, then we don't have another option. :)

from gettext.

whatyouhide avatar whatyouhide commented on May 21, 2024

@josevalim I'm not sure but when you take a .pot file and create a new .po file from that file using poedit, msgstrs are empty (""), so I guess this is the correct behaviour? I can't find a "filter" option in poedit to show what needs to be translated but when you make poedit check for problems with translations, it reports this:

screen shot 2015-11-21 at 16 20 45

The translations that it reports as "not translated yet" are just translations with empty msgstr.

from gettext.

josevalim avatar josevalim commented on May 21, 2024

@whatyouhide so we should do it on our gettext side, you are right. If we have an empty string, we should show msgid.

from gettext.

whatyouhide avatar whatyouhide commented on May 21, 2024

@josevalim yep. Should we warn somewhere for this kind of things? Something akin to ".po file for locale pt_BR exists but this translation is empty"?

from gettext.

josevalim avatar josevalim commented on May 21, 2024

If we are going to warn, then we need a way to copy the msgid to msgstr, at least for english based locales. Otherwise, I would go with no warning.

from gettext.

whatyouhide avatar whatyouhide commented on May 21, 2024

Ok, #56 got merged so now the behaviour for translations with empty msgstr is to just default to the msgsid. (for plural translation, "empty msgstr" means one or more empty msgstrs)

from gettext.

chrismccord avatar chrismccord commented on May 21, 2024

😻

from gettext.

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.