Menu

#1376 Localization of CDK Depictions

master
closed
nobody
None
1
2015-12-12
2015-12-11
No

We are using the CDK for our project and experimented with the new CDK 1.5.12 release and the depiction generator. However, we noticed a problem when generating SVGs for molecules:
The numbers in the SVG string seem to be localized according to the system environment. On systems with german language the numbers contain a comma instead of a dot, since in German you usually use a comma as decimal separator. This causes the generated SVG to not be readable by any other application.
If we set the JVM environment to English, the SVGs look fine. This is only a workaround, though, since we cannot guarantee that our program, which uses the depiction engine, is always run in an English environment.

To reproduce the behavior, just create an SVG string out of a valid AtomContainer with the following JVM argument:

-Duser.language=en

I suspect the problem is the class "SvgDrawVisitor". It uses "java.text.DecimalFormat" to produce nice formatted numbers, but this class uses the system localization by default.

Related

Bugs: #1376

Discussion

  • Sven Schrinner

    Sven Schrinner - 2015-12-11

    Sorry, the JVM argument must be

    -Duser.language=de

    to generate "unreadable" SVGs.

     
    • John May

      John May - 2015-12-11

      Thanks for pointing this out, should be an easy fix.

      John

      Regards,
      John W May
      john.wilkinsonmay@gmail.com

      On 11 December 2015 at 13:28, Sven Schrinner schrins@users.sf.net wrote:

      Sorry, the JVM argument must be

      -Duser.language=de

      to generate "unreadable" SVGs.

      Status: open
      Group: master
      Created: Fri Dec 11, 2015 01:24 PM UTC by Sven Schrinner
      Last Updated: Fri Dec 11, 2015 01:24 PM UTC
      Owner: nobody

      We are using the CDK for our project and experimented with the new CDK
      1.5.12 release and the depiction generator. However, we noticed a problem
      when generating SVGs for molecules:
      The numbers in the SVG string seem to be localized according to the system
      environment. On systems with german language the numbers contain a comma
      instead of a dot, since in German you usually use a comma as decimal
      separator. This causes the generated SVG to not be readable by any other
      application.
      If we set the JVM environment to English, the SVGs look fine. This is only
      a workaround, though, since we cannot guarantee that our program, which
      uses the depiction engine, is always run in an English environment.

      To reproduce the behavior, just create an SVG string out of a valid
      AtomContainer with the following JVM argument:

      -Duser.language=en

      I suspect the problem is the class "SvgDrawVisitor". It uses
      "java.text.DecimalFormat" to produce nice formatted numbers, but this class
      uses the system localization by default.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/cdk/bugs/1376/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #1376

  • John May

    John May - 2015-12-11
     
  • John May

    John May - 2015-12-12
    • status: open --> closed