etc/propgen/com/mxgraph/properties/PropGen.java
public static void execute(File tsvFile) throws IOException
	{
		if (tsvFile != null)
		{
			BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(tsvFile), "UTF-8"));

			// First line contains full language names
			in.readLine();

			// Second line contains file extensions
			String line = in.readLine();

			if (line != null)
			{
				String[] codes = line.split("\t");

				if (codes.length > 0)
				{
					if (codes[0].equals(""))
					{
						codes[0] = "i18n";
					}
					
					StringBuilder[] outputFiles = new StringBuilder[codes.length];

					while ((line = in.readLine()) != null)
					{
						String[] entries = line.split("\t");

						if (entries.length > 1)
						{
							String key = entries[0];

							if (key != null && key.length() > 0)
							{
								for (int i = 0; i < outputFiles.length; i++)
								{
									if (!codes[i].equals(""))
									{
										if (outputFiles[i] == null)
										{
											outputFiles[i] = new StringBuilder();
										}
										
										if (codes[i] == "i18n")
										{
											outputFiles[i].append(key + "=" + key + "\n");
										}
										else
										{
											String value = (entries.length > i) ? entries[i] : "";
	
											// Empty entries will be translated to English
											if (value.equals(""))
											{
												value = entries[1];
											}
	
											if (PropGen.encodeValues)
											{
												value = encodeString(value);
											}
	
											String lang = codes[i].toLowerCase();
											boolean rtl = false;
											
											if (lang.equals("ar") || lang.equals("fa") || lang.equals("he"))
											{
												Bidi bidi = new Bidi(value, 0);
												
												if (!bidi.isLeftToRight())
												{
													System.out.println(value);
													rtl = true;
												}
											}
											
											if (rtl)
											{
												outputFiles[i].append(key + "=" + "\u202B" + value + "\u202C" + "\n");
											}
											else
											{
												// Checks for HTML entities in output
												if (value.contains("<") || value.contains(">"))
												{
													System.out.println("**** WARNING: HTML Entities in " + lang + "/" + key + "=" + value);
												}

												outputFiles[i].append(key + "=" + value + "\n");
											}
										}
									}
								}
							}
						}
					}

					for (int i = 0; i < codes.length; i++)
					{
						if (!codes[i].equals(""))
						{
							String ext = (codes[i].equals("en")) ? "" : "_" + codes[i].toLowerCase();
							File file = new File(tsvFile.getParent() + "/dia" + ext + "." + fileExtension);
							BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
							writer.write("# *DO NOT DIRECTLY EDIT THIS FILE, IT IS AUTOMATICALLY GENERATED AND IT IS BASED ON:*\n");
							writer.write("# https://docs.google.com/spreadsheet/ccc?key=0AmQEO36liL4FdDJLWVNMaVV2UmRKSnpXU09MYkdGbEE\n");

							writer.write(outputFiles[i].toString());
							writer.close();

							System.out.println(file.getAbsolutePath() + " created");
						}
					}
				}
			}

			in.close();
		}
		else
		{
			System.out.println("No file specified");
		}
	}
/**
	 * Creates the translations for the given files.
	 */
Creates the translations for the given files.
Creates the translations for the given files .
public static void execute(File tsvFile) throws IOException
	{
		if (tsvFile != null)
		{
			BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(tsvFile), "UTF-8"));
			in.readLine();
			String line = in.readLine();
			if (line != null)
			{
				String[] codes = line.split("\t");
				if (codes.length > 0)
				{
					if (codes[0].equals(""))
					{
						codes[0] = "i18n";
					}
					StringBuilder[] outputFiles = new StringBuilder[codes.length];
					while ((line = in.readLine()) != null)
					{
						String[] entries = line.split("\t");
						if (entries.length > 1)
						{
							String key = entries[0];
							if (key != null && key.length() > 0)
							{
								for (int i = 0; i < outputFiles.length; i++)
								{
									if (!codes[i].equals(""))
									{
										if (outputFiles[i] == null)
										{
											outputFiles[i] = new StringBuilder();
										}
										if (codes[i] == "i18n")
										{
											outputFiles[i].append(key + "=" + key + "\n");
										}
										else
										{
											String value = (entries.length > i) ? entries[i] : "";
											if (value.equals(""))
											{
												value = entries[1];
											}
											if (PropGen.encodeValues)
											{
												value = encodeString(value);
											}
											String lang = codes[i].toLowerCase();
											boolean rtl = false;
											if (lang.equals("ar") || lang.equals("fa") || lang.equals("he"))
											{
												Bidi bidi = new Bidi(value, 0);
												if (!bidi.isLeftToRight())
												{
													System.out.println(value);
													rtl = true;
												}
											}
											if (rtl)
											{
												outputFiles[i].append(key + "=" + "\u202B" + value + "\u202C" + "\n");
											}
											else
											{
												if (value.contains("<") || value.contains(">"))
												{
													System.out.println("**** WARNING: HTML Entities in " + lang + "/" + key + "=" + value);
												}
												outputFiles[i].append(key + "=" + value + "\n");
											}
										}
									}
								}
							}
						}
					}
					for (int i = 0; i < codes.length; i++)
					{
						if (!codes[i].equals(""))
						{
							String ext = (codes[i].equals("en")) ? "" : "_" + codes[i].toLowerCase();
							File file = new File(tsvFile.getParent() + "/dia" + ext + "." + fileExtension);
							BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
							writer.write("# *DO NOT DIRECTLY EDIT THIS FILE, IT IS AUTOMATICALLY GENERATED AND IT IS BASED ON:*\n");
							writer.write("# https://docs.google.com/spreadsheet/ccc?key=0AmQEO36liL4FdDJLWVNMaVV2UmRKSnpXU09MYkdGbEE\n");
							writer.write(outputFiles[i].toString());
							writer.close();
							System.out.println(file.getAbsolutePath() + " created");
						}
					}
				}
			}
			in.close();
		}
		else
		{
			System.out.println("No file specified");
		}
	}
public static void execute ( File tsvFile ) throws IOException { if ( tsvFile != null ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( new FileInputStream ( tsvFile ) , "UTF-8" ) ) ; in . readLine ( ) ; String line = in . readLine ( ) ; if ( line != null ) { String [ ] codes = line . split ( "\t" ) ; if ( codes . length > 0 ) { if ( codes [ 0 ] . equals ( "" ) ) { codes [ 0 ] = "i18n" ; } StringBuilder [ ] outputFiles = new StringBuilder [ codes . length ] ; while ( ( line = in . readLine ( ) ) != null ) { String [ ] entries = line . split ( "\t" ) ; if ( entries . length > 1 ) { String key = entries [ 0 ] ; if ( key != null && key . length ( ) > 0 ) { for ( int i = 0 ; i < outputFiles . length ; i ++ ) { if ( ! codes [ i ] . equals ( "" ) ) { if ( outputFiles [ i ] == null ) { outputFiles [ i ] = new StringBuilder ( ) ; } if ( codes [ i ] == "i18n" ) { outputFiles [ i ] . append ( key + "=" + key + "\n" ) ; } else { String value = ( entries . length > i ) ? entries [ i ] : "" ; if ( value . equals ( "" ) ) { value = entries [ 1 ] ; } if ( PropGen . encodeValues ) { value = encodeString ( value ) ; } String lang = codes [ i ] . toLowerCase ( ) ; boolean rtl = false ; if ( lang . equals ( "ar" ) || lang . equals ( "fa" ) || lang . equals ( "he" ) ) { Bidi bidi = new Bidi ( value , 0 ) ; if ( ! bidi . isLeftToRight ( ) ) { System . out . println ( value ) ; rtl = true ; } } if ( rtl ) { outputFiles [ i ] . append ( key + "=" + "\u202B" + value + "\u202C" + "\n" ) ; } else { if ( value . contains ( "<" ) || value . contains ( ">" ) ) { System . out . println ( "**** WARNING: HTML Entities in " + lang + "/" + key + "=" + value ) ; } outputFiles [ i ] . append ( key + "=" + value + "\n" ) ; } } } } } } } for ( int i = 0 ; i < codes . length ; i ++ ) { if ( ! codes [ i ] . equals ( "" ) ) { String ext = ( codes [ i ] . equals ( "en" ) ) ? "" : "_" + codes [ i ] . toLowerCase ( ) ; File file = new File ( tsvFile . getParent ( ) + "/dia" + ext + "." + fileExtension ) ; BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( file ) , "UTF-8" ) ) ; writer . write ( "# *DO NOT DIRECTLY EDIT THIS FILE, IT IS AUTOMATICALLY GENERATED AND IT IS BASED ON:*\n" ) ; writer . write ( "# https://docs.google.com/spreadsheet/ccc?key=0AmQEO36liL4FdDJLWVNMaVV2UmRKSnpXU09MYkdGbEE\n" ) ; writer . write ( outputFiles [ i ] . toString ( ) ) ; writer . close ( ) ; System . out . println ( file . getAbsolutePath ( ) + " created" ) ; } } } } in . close ( ) ; } else { System . out . println ( "No file specified" ) ; } }
Creates the translations for the given files.
Creates the translations for the given files .
// First line contains full language names // Second line contains file extensions // Empty entries will be translated to English // Checks for HTML entities in output