Modify

Opened 9 days ago

Closed 9 days ago

Last modified 9 days ago

#15298 closed enhancement (fixed)

Use rpm return value instead of localized message

Reported by: jirislaby@… Owned by: team
Priority: normal Milestone: 17.09
Component: Core Version:
Keywords: Cc:

Description

From src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java:

    // rpm returns translated string "package %s is not installed\n", can't find a way to force english output
    // translations from https://github.com/rpm-software-management/rpm
    private static final String[] NOT_INSTALLED = {
            "not installed",          // en
            "no s'ha instal·lat",     // ca
            "尚未安裝",                // cmn
...

rpm respects locales:

$ rpm -q test
balíček test není nainstalován
$ LANG=en rpm -q test
package test is not installed
$ LANG=POSIX rpm -q test
package test is not installed

So just set the environment variable to POSIX (or to en) and you are done.

Attachments (0)

Change History (12)

comment:1 Changed 9 days ago by anonymous

Or even better, use the return value of rpm.

$ LANG=en rpm -q test
package test is not installed
$ echo $?
1
$ rpm -q rpm
rpm-4.13.0.1-5.2.x86_64
$ echo $?
0

comment:2 Changed 9 days ago by Don-vip

Resolution: invalid
Status: newclosed

WTH is this bug report, you mean? We cannot control the locale set by all JOSM users.

comment:3 Changed 9 days ago by Jiri Slaby <jirislaby@…>

Resolution: invalid
Status: closedreopened

But you can control locale of rpm.

Or you can use rpm return value.

comment:4 Changed 9 days ago by Don-vip

Milestone: 17.09
Summary: WTH is String[] NOT_INSTALLED ?Use rpm return value instead of localized message
Type: defectenhancement

OK. But please avoid tickets with such titles...

comment:5 Changed 9 days ago by Jiri Slaby <jirislaby@…>

Summary: Use rpm return value instead of localized messageWTH is String[] NOT_INSTALLED ?
Type: enhancementdefect

It was so funny when I saw it, that I though the author cannot really mean it.

So FWIW:

import java.io.IOException;

class env {
        public static void main(String args[]) {
                try {
                        ProcessBuilder pb =
                                new ProcessBuilder().inheritIO().command(
                                        new String[] {"rpm", "-q", "test"});
                        pb.environment().put("LANG", "POSIX");
                        Process p = pb.start();

                } catch (IOException e) {
                        System.err.println(e);
                }
        }
}

comment:6 Changed 9 days ago by Jiri Slaby <jirislaby@…>

Summary: WTH is String[] NOT_INSTALLED ?Use rpm return value instead of localized message (was: WTH is String[] NOT_INSTALLED ?)

oops

comment:7 Changed 9 days ago by Jiri Slaby <jirislaby@…>

Keywords: java9 added

comment:8 Changed 9 days ago by Jiri Slaby <jirislaby@…>

Keywords: java9 removed
Type: defectenhancement

comment:9 Changed 9 days ago by Don-vip

Summary: Use rpm return value instead of localized message (was: WTH is String[] NOT_INSTALLED ?)Use rpm return value instead of localized message

comment:10 Changed 9 days ago by Don-vip

Well keep in mind we have a lot of bug reports to handle, and this kind of titles is not funny for us. Thanks for reporting it.

comment:11 Changed 9 days ago by Don-vip

Resolution: fixed
Status: reopenedclosed

In 12830/josm:

fix #15297, fix #15298 - proper detection of java packages on rpm-based Linux systems

comment:12 Changed 9 days ago by Don-vip

Not tested, can you please check tomorrow if everything's OK?

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.