Coder Social home page Coder Social logo

replacing \ with \\ about translate HOT 6 CLOSED

translate avatar translate commented on June 22, 2024
replacing \ with \\

from translate.

Comments (6)

transl8bzimport avatar transl8bzimport commented on June 22, 2024

Originally posted by David Farning:

After looking into this more deeply it looks like the orginal .properties author
escaped colons. Thus : becomes \:

I don’t know enough about the code base to make a patch but my orginal guess
involves making a change in misc/quotes.py.

Should lines 176 and 182 add the ability to handle :

-dtf

from translate.

davidfraser avatar davidfraser commented on June 22, 2024

The trouble here is that : doesn’t need to be quoted in a properties file or in
a .po file. So our choices are:

1) Drop the \ in front of the :
Then in the PO file we have a nice simple :
The problem is that we will not regenerate the \ in the properties file
Whether this is a problem or not is debatable, since it sholdn’t be there in the
first place…

2) Include a single \ in the PO file, and keep it when converting back.
This would be fairly confusing as PO files don’t usually escape : and a \ in a
PO file should be escaped

3) Include a double \ in the PO file, and keep that double backslash when
converting back.
This is the current situation which leads us to a double backslash in the
.properties file

4) Include a double \ in the PO file, and convert it back to a single backslash
in the .properties file
The trouble with this is that it is inconsistent with backslash escaping of \n
etc…

We’d need to evaluate the above 4 options before deciding what to do.

from translate.

transl8bzimport avatar transl8bzimport commented on June 22, 2024

Originally posted by David Farning:

I was looking through the translations this morning and noticed that some
translators like to escape colons, equal-signs, and semi-colons. I googling to
try to determine if there is a reason in any language for escaping those characters.

If there is no reason for escaping those characters in the first place, the best
bet would seem to be to ask tranlators not to escape them. Otherwise we run the
risk of turning a bug into a feature.

from translate.

transl8bzimport avatar transl8bzimport commented on June 22, 2024

Originally posted by David Farning:

The colons and equal-signs are escaped in mozilla .properties files in order to
meet the specifications of java .properties files. The Java spec is at
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html

This bug is strongly correlated with http://bugs.wordforge.org/show_bug.cgi?id=12

This would indicate that a perferred solution would be to drop the / on colons
and equals-signs when transforming to .po and stick the / back on whenever
rebuilding a .properties file.

from translate.

davidfraser avatar davidfraser commented on June 22, 2024

Re comment 4:
I think you want to s#/## there…

At the moment adding the \ in before all colons would probably cause a lot more
changes than the ones its trying to fix, so I’m not keen on that unless Mozilla
does decide to make it a standard, in which case it could be don eafter 1.5

from translate.

dwaynebailey avatar dwaynebailey commented on June 22, 2024

Mozilla .properties don’t correctly follow the Java properties spec. So until
they do we’ll be running a rat race to catch corner cases. Thus closing this as
WONTFIX

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.