Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years 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 by anonymous, 7 years ago

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 by Don-vip, 7 years ago

Resolution: invalid
Status: newclosed

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

comment:3 by Jiri Slaby <jirislaby@…>, 7 years ago

Resolution: invalid
Status: closedreopened

But you can control locale of rpm.

Or you can use rpm return value.

comment:4 by Don-vip, 7 years ago

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 by Jiri Slaby <jirislaby@…>, 7 years ago

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 by Jiri Slaby <jirislaby@…>, 7 years ago

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

oops

comment:7 by Jiri Slaby <jirislaby@…>, 7 years ago

Keywords: java9 added

comment:8 by Jiri Slaby <jirislaby@…>, 7 years ago

Keywords: java9 removed
Type: defectenhancement

comment:9 by Don-vip, 7 years ago

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 by Don-vip, 7 years ago

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 by Don-vip, 7 years ago

Resolution: fixed
Status: reopenedclosed

In 12830/josm:

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

comment:12 by Don-vip, 7 years ago

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.