Comments (15)
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.
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.
\ Bug #29 has been marked as a duplicate of this bug. *
from translate.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Created [attachment 36](http://bugs.locamotion.org/attachment.cgi?id=36)
Test DTD file with config options
from translate.
Created [attachment 37](http://bugs.locamotion.org/attachment.cgi?id=37)
Test .properties file with config options
from translate.
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)
- Extract only text from IDML by idml2po
- support several input parameters for pofilter (and other commands)
- Support for Android resource converter HOT 4
- prop2po: support for different encodings for both the input file and the template
- prop2po: personality given in command line is ignored for .strings files HOT 2
- Locate tests and test data outside 'translate' module HOT 2
- Ben
- Android: Some strings marked as `translatable="false"` still treated as translatable HOT 2
- Code block not parsed from Markdown HOT 3
- Proposal to use mdit-py-i18n (along with markdown-it-py) for Markdown support HOT 7
- Reduce question mark escaping in Android
- tests/translate/convert/test_rc2po.py failures with Python 3.12 HOT 7
- Translate
- Use Windows newlines for resx files
- Do not include "Explanation" field in iOS strings files HOT 2
- Add support for Mobile Kotlin resources HOT 3
- Locations for Markdown HOT 1
- Add support for Apple String Catalogs HOT 3
- Weird handling of C1 control characters in .properties files HOT 3
- Translate org app requests HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from translate.