Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 40 package org.dspace.content; 41 42 import java.util.Locale ; 43 44 50 public class DCLanguage 51 { 52 53 private String country; 54 55 56 private String language; 57 58 64 public DCLanguage(String l) 65 { 66 setLanguage(l); 67 } 68 69 74 public String toString() 75 { 76 if (language.equals("")) 77 { 78 return ""; 79 } 80 else if (country.equals("")) 81 { 82 return language; 83 } 84 else 85 { 86 return country + "_" + language; 87 } 88 } 89 90 96 public void setLanguage(String l) 97 { 98 if (l.equals("other")) 99 { 100 language = "other"; 101 country = ""; 102 } 103 else if (l.length() == 2) 104 { 105 language = l; 106 country = ""; 107 } 108 else if (l.length() == 5) 109 { 110 language = l.substring(0, 2); 111 country = l.substring(3); 112 } 113 else 114 { 115 language = ""; 116 country = ""; 117 } 118 } 119 120 125 public String getDisplayName() 126 { 127 Locale locale; 128 129 if (language.equals("other")) 130 { 131 return "(Other)"; 132 } 133 else if (language.equals("")) 134 { 135 return "N/A"; 136 } 137 else 138 { 139 locale = new Locale (language, country); 140 141 return locale.getDisplayName(); 142 } 143 } 144 } 145
| Popular Tags
|