[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/imagex/postlet/rev165/ -> PostletLabels.java (source)

   1  /*    Copyright (C) 2005 Simon David Rycroft
   2  
   3      This program is free software; you can redistribute it and/or
   4      modify it under the terms of the GNU General Public License
   5      as published by the Free Software Foundation; either version 2
   6      of the License, or (at your option) any later version.
   7  
   8      This program is distributed in the hope that it will be useful,
   9      but WITHOUT ANY WARRANTY; without even the implied warranty of
  10      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11      GNU General Public License for more details.
  12  
  13      You should have received a copy of the GNU General Public License
  14      along with this program; if not, write to the Free Software
  15      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  16  import java.io.BufferedReader;
  17  import java.io.FileNotFoundException;
  18  import java.io.IOException;
  19  import java.net.URL;
  20  import java.io.InputStreamReader;
  21  
  22  public class PostletLabels {
  23  
  24      // languages listed by their two letter codes (http://www.w3.org/WAI/ER/IG/ert/iso639.htm)
  25      // The compiled in languages will be:
  26      // English
  27      // Spainish
  28      // Dutch
  29      // German
  30      // French
  31      // Italian
  32      // Portuguese
  33  
  34      // Current: EN, DE, NL, FR, ES, IT, NO, TU, FI
  35      private String [] language;
  36  
  37      private static final int numLabels = 17;
  38  
  39      private static final String [][] languages = {{
  40                  "EN",
  41                  "Filename",            //0
  42                  "File Size",        //1
  43                  "Finished",            //2
  44                  "The destination URL provided is not a valid one.", //3
  45                  "You have not provided a destination URL.",         //4
  46                  "Postlet error",    //5
  47                  "Add",                //6
  48                  "Remove",            //7
  49                  "Upload",            //8
  50                  "Help",                //9
  51                  "Upload progress:",    //10
  52                  "Do not close your web browser, or leave this page until upload completes.", //11
  53                  "Postlet warning",    //12
  54                  "Image files",        //13
  55                  "Select file for upload", //14
  56                  "The help URL provided is not a valid one.",
  57                  "The following files failed to upload"},
  58                  {
  59                  "DE",
  60                  "Dateiname",//0
  61                  "Dateigröße",//1
  62                  "Fertig",
  63                  "Die angegebene Ziel-URL ist ungültig.",
  64                  "Es ist keine Ziel-URL angegeben.",
  65                  "Postlet Fehler",
  66                  "Hinzufügen",
  67                  "Entfernen",
  68                  "Upload",
  69                  "Hilfe",
  70                  "Upload prozess:",
  71                  "Der Browser darf nicht geschlossen werden solange der Upload läuft.",
  72                  "Postlet Warnung",
  73                  "Bild-Dateien",
  74                  "Datei zum hochladen auswählen",
  75                  "Die angegebene Hilfe-URL ist nicht gültig.",
  76                  "The following files failed to upload"},
  77                  {
  78                  "NL",
  79                  "Bestands naam",
  80                  "Bestands grootte",
  81                  "Klaar",
  82                  "De opgegeven doel URL is niet correct.",
  83                  "U heeft geen doel URL opgegeven.",
  84                  "Postlet fout",
  85                  "Toevoegen",
  86                  "Verwijder",
  87                  "Upload",
  88                  "Help",
  89                  "Upload voortgang",
  90                  "Uw web browser niet sluiten, of deze pagina verlaten tot dat de upload compleet is.",
  91                  "Postlet waarschuwing",
  92                  "Plaatjes bestanden",
  93                  "Selecteer bestand voor upload",
  94                  "De help URL is niet correct",
  95                  "The following files failed to upload"},
  96                  {
  97                  "FR",
  98                  "Nom de fichier", //0
  99                  "Taille du fichier", //1
 100                  "Terminé", //2
 101                  "L'URL de destination fournie n'est pas valide.", //3
 102                  "Vous n'avez pas fourni d'URL de destination.", //4
 103                  "Erreur Postlet", //5
 104                  "Ajouter", //6
 105                  "Enlever", //7
 106                  "Envoyer", //8
 107                  "Aide", //9
 108                  "Progression de l'envoi:", //10
 109                  "Ne fermer pas votre browser et rester sur cette page jusqu'à l'envoi complet des données.", //11
 110                  "Avertissement Postlet", //12
 111                  "Fichiers image", //13
 112                  "Selectionner les fichiers à envoyer", //14
 113                  "L'URL de l'aide fournie n'est pas valide.",
 114                  "The following files failed to upload"},
 115                  {
 116                  "ES",
 117                  "Fichero",            //0
 118                  "Tamaño",            //1
 119                  "Terminado",        //2
 120                  "La URL destino no es válida.", //3
 121                  "No hay una URL destino especificada.",         //4
 122                  "Postlet error",    //5
 123                  "Añadir",            //6
 124                  "Quitar",            //7
 125                  "Subir",            //8
 126                  "Ayuda",            //9
 127                  "Progreso de la transferencia:",     //10
 128                  "No cerrar el navegador o esta ventana hasta que la transferencia haya terminado.", //11
 129                  "Aviso del Postlet",//12
 130                  "Ficheros de imágenes",//13
 131                  "Selecciona los ficheros para subir", //14
 132                  "La URL de ayuda no es válida.",
 133                  "The following files failed to upload"},
 134                  {
 135                  "IT",
 136                  "Nome File",//0
 137                  "Dimensione File",//1
 138                  "Terminato",//2
 139                  "L'indirizzo fornito non è valido.",//3
 140                  "Non hai inserito un indirizzo di destinazione.",//4
 141                  "Errore di Postlet",//5
 142                  "Aggiungi",//6
 143                  "Rimuovi",//7
 144                  "Trasferisci",//8
 145                  "Help",//9
 146                  "Stato del trasferimento",//10
 147                  "Non chiudere il browser o cambiare pagina finché il trasferimento non è finito.",//11
 148                  "Avvertimento di Postlet",//12
 149                  "File immagine",//13
 150                  "Seleziona il file da trasferire",//14
 151                  "L'indirizzo dell'help non è valido.",
 152                  "The following files failed to upload"},
 153                  {
 154                  "NO",
 155                  "Filnavn",
 156                  "Fil størrelse",
 157                  "Ferdig",
 158                  "Den URL du oppgav er ikke gyldig.",
 159                  "Du har ikke oppgitt en URL.",
 160                  "Postlet feil",
 161                  "Legg til",
 162                  "Ta bort",
 163                  "Last opp",
 164                  "Hjelp",
 165                  "Upload gjennomføring:",
 166                  "Lukk ikke igjen denne nettsiden, eller forlate nettsiden før opplastingen er ferdig.",
 167                  "Postlet advarsel",
 168                  "Bildefiler",
 169                  "Velg fil for opplasting",
 170                  "Den angitte hjelp URL er ikke gyldig.",
 171                  "The following files failed to upload"},
 172                  {
 173                  "FI",
 174                  "Tiedoston nimi",
 175                  "Tiedoston koko",
 176                  "Valmis",
 177                  "URL-osoitetta ei löydy",
 178                  "Kirjoita URL-osoite",
 179                  "Postlet -virhe",
 180                  "Lisää",
 181                  "Poista",
 182                  "lataa",
 183                  "Help",
 184                  "Lataaminen käynnissä",
 185                  "Älä sulje selainta tai poistu sivuilta ennen kuin lataaminen on päättynyt.",
 186                  "Postlet -varoitus",
 187                  "Kuvatiedostot",
 188                  "Valitse tiedosto, jonka aiot ladata",
 189                  "Help-toiminnon URL-osoitetta ei löydy.",
 190                  "The following files failed to upload"},
 191                  {
 192                  "TU",
 193                  "Dosya Adý",
 194                  "Dosya Boyutu",
 195                  "Bitti",
 196                  "Yazdýðýnýz URL desteklenen bir URL deðil!",
 197                  "Belirtilmiþ (desteklenen) bir URL niz yok!",
 198                  "Postlet Hatasý",
 199                  "Ekle",
 200                  "Kaldýr",
 201                  "Yükle",
 202                  "Yardým",
 203                  "Yükleme Süreci",
 204                  "Yükleme bitene kadar bu sayfayý kapatmayýn veya ayrýlmayýn.",
 205                  "Postlet uyarýsý",
 206                  "Resim (imaj) dosyalarý",
 207                  "Yükleme için dosya seçin",
 208                  "The help URL provided is not a valid one.",
 209                  "The following files failed to upload"},
 210                  {
 211                  "EMPTY",
 212                  "",
 213                  "",
 214                  "",
 215                  "",
 216                  "",
 217                  "",
 218                  "",
 219                  "",
 220                  "",
 221                  "",
 222                  "",
 223                  "",
 224                  "",
 225                  "",
 226                  "",
 227                  "",
 228                  ""}}; //15
 229  
 230      /** Creates a new instance of PostletLabels */
 231      public PostletLabels(String l, URL codeBase) {
 232          boolean languageIncluded = false;
 233          for (int i=0; i<languages.length; i++){
 234              if (languages[i][0].equalsIgnoreCase(l)){
 235                  languageIncluded = true;
 236                  language = languages[i];
 237                  break;
 238              }
 239          }
 240          if (!languageIncluded)
 241              readUserDefinedLanguageFile(codeBase, l);
 242      }
 243  
 244      public String getLabel(int i){
 245          if (i >= numLabels)
 246              return "ERROR!";
 247          return language[i+1];
 248      }
 249      // Method reads a standard named file, from the server (same directory as the
 250      // jar file), and sets the labels from this.
 251      private void readUserDefinedLanguageFile(URL codeBase, String lang){
 252          try {
 253              URL languageURL = new URL(codeBase.getProtocol()+"://"+codeBase.getHost()+codeBase.getPath()+"language_"+lang.toUpperCase().trim());
 254              BufferedReader in = new BufferedReader(new InputStreamReader(languageURL.openStream()));
 255              language = new String [numLabels];
 256              for (int i=0; i<numLabels; i++)
 257                  language[i]=in.readLine();
 258          }
 259          catch (FileNotFoundException fnf){
 260              // File not found, default used instead.
 261              language = languages[0];
 262          }
 263          catch (IOException ioe){
 264              // File probably too short.
 265              language = languages[0];
 266              System.out.println("Language file possibly too short, please ensure it has 18 lines, terminated by a final carriage return");
 267          }
 268      }
 269  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7