KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > LocaleManager


1 /*
2  * eAdmin/OWX
3  * Copyright (C) 1996-2003 OWX-Project Team <owx-team@gmx.net>
4  */

5
6 package com.raptus.owxv3;
7
8
9 /**
10  * This is just a stub class for capsulating code related to
11  * locale management. The locales are used for users and the
12  * virtual module support.
13  *
14  * <hr>
15  * <table width="100%" border="0">
16  * <tr>
17  * <td width="24%"><b>Filename</b></td><td width="76%">LocaleManager.java</td>
18  * </tr>
19  * <tr>
20  * <td width="24%"><b>Author</b></td><td width="76%">Guy Zürcher (gzuercher@raptus.com)</td>
21  * </tr>
22  * <tr>
23  * <td width="24%"><b>Date</b></td><td width="76%">15th of April 2001</td>
24  * </tr>
25  * </table>
26  * <hr>
27  * <table width="100%" border="0">
28  * <tr>
29  * <td width="24%"><b>Date / Author</b></td><td width="76%"><b>Changes</b></td>
30  * </tr>
31  * </table>
32  * <hr>
33  */

34 public class LocaleManager extends Object JavaDoc
35 {
36     /**
37      * Separates a locale-string in its country and language parts.
38      * If just either was specified, the returned pair of objects
39      * is empty.
40      *
41      * @param locale locale string (excpected format: xx_XX)
42      *
43      * @return a pair of objects instance containing the language
44      * as the first pair, the country as the second.
45      */

46     public static PairOfObjects stripLocaleString(String JavaDoc locale)
47     {
48         PairOfObjects po = new PairOfObjects();
49
50         int nPos = locale.indexOf('_');
51         if(nPos == -1)
52         {
53             LoggingManager.log("Locale format is wrong! " + locale);
54             return po; // is null anyway
55
}
56
57         po.setObjects(locale.substring(0, nPos), // one == language
58
locale.substring(nPos+1)); // two == country
59
return po;
60     }
61 }
62
63 /* end class LocaleMgr */
64
Popular Tags