1 8 package org.apache.avalon.excalibur.i18n; 9 10 import java.util.Locale ; 11 12 18 public class BundleInfo { 19 20 private String name; 21 private Locale locale; 22 private String ext; 23 24 public BundleInfo() { 25 this(null, null, null); 26 } 27 28 public BundleInfo(String name, Locale locale) { 29 this(name, locale, null); 30 } 31 32 public BundleInfo(String name, Locale locale, String ext) { 33 this.name = name; 34 this.locale = locale; 35 this.ext = ext; 36 } 37 38 protected void setName(String name) { 39 this.name = name; 40 } 41 42 protected void setLocale(Locale locale) { 43 this.locale = locale; 44 } 45 46 protected void setExtensionParameter(String ext) { 47 this.ext = ext; 48 } 49 50 public String getName() 51 { 52 return this.name; 53 } 54 55 public Locale getLocale() 56 { 57 return this.locale; 58 } 59 60 public String getExtensionParameter() 61 { 62 return this.ext; 63 } 64 65 public String toString() 66 { 67 return "BundleInfo(" + this.name + "," + this.locale + "," + this.ext + ")"; 68 } 69 70 public BundleInfo getParent() 71 { 72 if (this.locale != null && !this.locale.getLanguage().equals("")) 73 return new BundleInfo(this.name, this.getParentLocale(), this.ext); 74 else 75 return null; 76 } 77 78 86 protected Locale getParentLocale() 87 { 88 Locale newloc; 89 if (this.locale.getVariant().equals("")) 90 { 91 if (this.locale.getCountry().equals("")) 92 newloc = new Locale ("","",""); 93 else 94 newloc = new Locale (this.locale.getLanguage(), "", ""); 95 } 96 else 97 newloc = new Locale (this.locale.getLanguage(), this.locale.getCountry(), ""); 98 99 return newloc; 100 } 101 102 } 103 | Popular Tags |