Coder Social home page Coder Social logo

Comments (15)

okulev avatar okulev commented on July 21, 2024

I’ve fixed this problem in my private fork of translate toolkit by generating
“_: name\n” for msgid. When such string is seen in po2\* as prefix, it’s removed
so that when content of msgstr is filled with content of msgid, there are no
problems. Are you interested in such a solution? (The patch needs polishing if
it’s going to be shown in public.)

from translate.

davidfraser avatar davidfraser commented on July 21, 2024

in translate toolkit 0.8rc4, this generates a simple empty msgid / msgstr:
msgid ""
msgstr ""

however this gets detected as a blank po entry and is not output.
I have added a test to CVS in test_dtd2po.py that picks up this error
(test_emptyentity)

Ognyan, could you make your patch and attach it here? Then I will include it…

from translate.

davidfraser avatar davidfraser commented on July 21, 2024

\ Bug #29 has been marked as a duplicate of this bug. *

from translate.

okulev avatar okulev commented on July 21, 2024

My local Translate Toolkit is too old to make a patch.

There is a change in convert/dtd2po.py:convertstrings, where I added something like:

```
if len(msgid) == 0:
msgid = "_: " + quote.quotestr(thedtd.entity) + “\\n”
```

I think this is all but I can’t remember exactly if I had another change for
recognizing this _:. I think it wasn’t necessary.

from translate.

okulev avatar okulev commented on July 21, 2024

Hm, actually it’s relatively easy to generate this 2 line patch and then test
it. I feel a bit lazy about that though :-P Do you like this solution so that I
make a patch and test it?

from translate.

okulev avatar okulev commented on July 21, 2024

Created [attachment 30](http://bugs.locamotion.org/attachment.cgi?id=30)

Tested patch that handles empty values in dtd and prop

I switched to CVS Translate Toolkit and this is my remade support for empty
values in dtd and prop. Some of the things may not be done the right way but
it works :-)

from translate.

okulev avatar okulev commented on July 21, 2024

There is one change in the patch that is not directly about empty values:
- unquoted = unquoted.replace(“\”, “\\”)
- unquoted = unquoted.replace(“\n”,“\n”).replace(“\”,
“\\”).replace(“\n”,“\n\n”)

It’s for proper handling of multi-line DTD entity values.

from translate.

davidfraser avatar davidfraser commented on July 21, 2024

The way I’ve fixed this is by including empty po entries if they have a source
comment. This means we don’t have to put special case handling in for dtd and
properties files…
The test now passes, so marking this as fixed.
Could you open a fresh bug about the multiline DTD entities if there isn’t one
already? And also verify if this works for you now. Thanks

from translate.

okulev avatar okulev commented on July 21, 2024

gettext doesn’t like multiple msgid "" and this is what happens for
http://lxr.mozilla.org/mozilla1.8/source/toolkit/locales/en-US/chrome/global/dialog.properties
So I’m reopening this bug :-)

from translate.

okulev avatar okulev commented on July 21, 2024

Created [attachment 33](http://bugs.locamotion.org/attachment.cgi?id=33)

Same patch but without the new line fix

Here is the same patch, assuming that the patch for bug #83 is applied.

from translate.

davidfraser avatar davidfraser commented on July 21, 2024

OK the blank message ids were ignored in our duplicates merging, whereas
actually only headers should be ignored.
So we could use the duplicates system to do what you’re doing in the patch.
I’ve now committed code so that blank items can be given msgids like other
comments, if you say —duplicates=msgid_comment
They can also be merged kept etc.
If you’re using gettext tools you probably need —duplicates=msgid_comment
anyway, would this work for you?

from translate.

davidfraser avatar davidfraser commented on July 21, 2024

Dwayne and I discussed this at length.
The basic point is that blank msgids usually represent configuration options
that need to be filled in rather than text that needs to be translated.
So it never makes sense to merge them.
That leaves two options:
1) Leave them as duplicate entries, unchanged – this is a problem if you use
gettext tools on them
2) Add a msgid_comment to distinguish them
1) Makes sense if —duplicatestyle is keep as thats whats happening there for
everything.
For anything else we want 2)
So basically this means that for —duplicatestyle=merge we should add
msgid_comments as we do for msgid_comment and msgid_comment_all

Added a test for this and implemented it in CVS

from translate.

dwaynebailey avatar dwaynebailey commented on July 21, 2024

Created [attachment 36](http://bugs.locamotion.org/attachment.cgi?id=36)

Test DTD file with config options

from translate.

dwaynebailey avatar dwaynebailey commented on July 21, 2024

Created [attachment 37](http://bugs.locamotion.org/attachment.cgi?id=37)

Test .properties file with config options

from translate.

dwaynebailey avatar dwaynebailey commented on July 21, 2024

Created test files to validate this fix. Ran tests against each test file for
all the —duplicates styles. All worked as specified.

from translate.

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.