System Language?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nepomuk
    Recognized Expert Specialist
    • Aug 2007
    • 3111

    #1

    System Language?

    Hi!
    I'm developing a multi platform application with Java and have encountered a Problem:
    At one point, the application should find out the systems language or country. However, when I use
    [CODE=java]
    System.getPrope rty(...)
    [/CODE]I found, that with Windows with JRE 1.6.0_02 the property is "user.langu age" or "user.count ry" and under Ubuntu Linux with JRE 1.4.2 it's "user.langu age" or "user.regio n".

    Now I'm wondering: Is that dependent on the version of JRE or is it platform dependent or is it something even more complicated? And also, what other Properties are there, that give this information on other Systems? For example: Does Solaris have different Properties? (Macs aren't of necessary, though I wouldn't mind.) Is "user.langu age" offered on every system?

    Of course, if anyone knows a better way of retrieving the systems language, I'm open to that.

    Greetings,
    Nepomuk

    P.S.: This is the code I used to find those properties:
    [CODE=java]
    public class Properties {
    public static void main(String[] args)
    {
    if (args == null || args.length == 0)
    {
    java.util.Enume ration e = System.getPrope rties().propert yNames();
    while (e.hasMoreEleme nts())
    {
    String key = (String)e.nextE lement();
    System.out.prin tln(key +"\t : \t"+ System.getPrope rty(key));
    }
    }
    else
    {
    for (int n = 0; n < args.length; ++ n)
    {
    if (args[n] != null && args[n].length() > 0)
    {
    String p = System.getPrope rty(args[n]);
    if (p != null)
    System.out.prin tln(p);
    }
    }
    }
    }
    }
    [/CODE]
    [/CODE]
    Last edited by Nepomuk; Sep 6 '07, 12:47 PM. Reason: Found more possible Properties...
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Can Locale.getDefau lt() be of any help?

    kind regards,

    Jos

    Comment

    • Nepomuk
      Recognized Expert Specialist
      • Aug 2007
      • 3111

      #3
      Originally posted by JosAH
      Can Locale.getDefau lt() be of any help?

      kind regards,

      Jos
      Indeed, it can! :-)
      Thank you, that's the sort of command I was looking for. Just a bit annoying, that the ISO 639 standard isn't stable... But I guess it won't change in any of the languages I'll be using.

      Greetings,
      Nepomuk

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by nepomuk
        Indeed, it can! :-)
        Thank you, that's the sort of command I was looking for. Just a bit annoying, that the ISO 639 standard isn't stable... But I guess it won't change in any of the languages I'll be using.

        Greetings,
        Nepomuk
        Don't blame ISO for that; blame the world for it ;-)

        kind regards,

        Jos

        Comment

        • Nepomuk
          Recognized Expert Specialist
          • Aug 2007
          • 3111

          #5
          Originally posted by JosAH
          Don't blame ISO for that; blame the world for it ;-)

          kind regards,

          Jos
          Blame the world for an ISO Standard, that's inconstant? Oh dear, mother earth will be disappointed... ;-)

          Greetings,
          Nepomuk

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by nepomuk
            Blame the world for an ISO Standard, that's inconstant? Oh dear, mother earth will be disappointed... ;-)

            Greetings,
            Nepomuk
            Mother Earth already *is* disappointed; see that silly Bush trick and his little
            timezone change lately. He's a little loony ~8^} his little blooper caused major
            havoc around the world where all computers needed new locale definitions.

            Gaya doesn't approve, I'm sure.

            kind regards,

            Jos

            Comment

            • Nepomuk
              Recognized Expert Specialist
              • Aug 2007
              • 3111

              #7
              Originally posted by JosAH
              Mother Earth already *is* disappointed; see that silly Bush trick and his little
              timezone change lately. He's a little loony ~8^} his little blooper caused major
              havoc around the world where all computers needed new locale definitions.

              Gaya doesn't approve, I'm sure.

              kind regards,

              Jos
              Hm, good point - on the other hand, this is more the sort of discussion, that should be held in the Café. ^^

              Greetings,
              Nepomuk

              Comment

              • JosAH
                Recognized Expert MVP
                • Mar 2007
                • 11453

                #8
                Originally posted by nepomuk
                Hm, good point - on the other hand, this is more the sort of discussion, that should be held in the Café. ^^

                Greetings,
                Nepomuk
                You started it by mentioning unstable ISO Standards ;-)

                kind regards,

                Jos

                Comment

                • Nepomuk
                  Recognized Expert Specialist
                  • Aug 2007
                  • 3111

                  #9
                  Originally posted by JosAH
                  You started it by mentioning unstable ISO Standards ;-)

                  kind regards,

                  Jos
                  I recall something you said in the Cafe...

                  "No, i didn't!" :-P

                  Comment

                  Working...