Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/languages/ukrainian.xml
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/languages/ukrainian.xml?rev=1409138&r1=1409137&r2=1409138&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/languages/ukrainian.xml 
(original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/languages/ukrainian.xml 
Wed Nov 14 10:23:08 2012
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
+
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
@@ -17,15 +18,14 @@
   specific language governing permissions and limitations
   under the License.
   
--->
 
-<!--###############################################
+
+###############################################
 This File is auto-generated by the LanguageEditor 
 to add new Languages or modify/customize it use the LanguageEditor 
 see http://incubator.apache.org/openmeetings/LanguageEditor.html for Details 
 ###############################################-->
-<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
-    xsi:noNamespaceSchemaLocation="language.xsd">
+<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:noNamespaceSchemaLocation="language.xsd">
   <string id="1" name="conference">
     <value>Конференція</value>
   </string>
@@ -2206,7 +2206,7 @@ see http://incubator.apache.org/openmeet
   </string>
   <string id="727" name="sharing session">
     <value>You are already sharing your desktop!</value>
-  </string>  
+  </string>
   <string id="728" name="sharing client">
     <value>Desktop Viewer</value>
   </string>
@@ -2668,10 +2668,10 @@ see http://incubator.apache.org/openmeet
   </string>
   <string id="881" name="room config">
     <value>Rights</value>
-  </string>  
+  </string>
   <string id="882" name="flvrecording">
     <value>Download as AVI</value>
-  </string>  
+  </string>
   <string id="883" name="flvrecording">
     <value>FLV</value>
   </string>
@@ -4049,7 +4049,7 @@ see http://incubator.apache.org/openmeet
   <string id="1341" name="submenu">
     <value>Load directly to whiteboard</value>
   </string>
-    <string id="1342" name="attendees">
+  <string id="1342" name="attendees">
     <value>Attendees</value>
   </string>
   <string id="1343" name="atendee manager">
@@ -4125,7 +4125,7 @@ see http://incubator.apache.org/openmeet
     <value>Not allowed</value>
   </string>
   <string id="1367" name="user_left_act_msg">
-    <value> has left the room.</value>
+    <value>has left the room.</value>
   </string>
   <string id="1368" name="clipart icons">
     <value>Math icons</value>
@@ -4206,10 +4206,10 @@ see http://incubator.apache.org/openmeet
     <value>Do you really want to mute this user globally? No other user will 
hear him anymore!</value>
   </string>
   <string id="1394" name="mute status icons">
-    <value>Your sound is on. Click here to send moderator message to mute your 
microphone globally  (in the complete conference room) off!</value>
+    <value>Your sound is on. Click here to send moderator message to mute your 
microphone globally (in the complete conference room) off!</value>
   </string>
   <string id="1395" name="mute status icons">
-    <value>Your sound is off. Click here to send moderator message to unmute 
your microphone globally  (in the complete conference room) on!</value>
+    <value>Your sound is off. Click here to send moderator message to unmute 
your microphone globally (in the complete conference room) on!</value>
   </string>
   <string id="1396" name="mute apply self on message">
     <value>would like that the moderator mutes my microphone globally.</value>
@@ -4539,61 +4539,66 @@ see http://incubator.apache.org/openmeet
     <value>Publishing. User:</value>
   </string>
   <string id="1505" name="cmd_line_admin">
-    <value>
-       To save time and internet traffic you can use command line admin to 
backup/restore/upgrade:\n
-       1) go to OM install dir (for ex. /opt/red5) \n
-       2) stop OM (for ex. ./red5-shutdown.sh)\n
-       3) ./admin.sh -b -file ~/today_om_backup.zip (create backup of current 
OM)\n
-       4) download archive with new OM\n
-       5) mv /opt/red5 /opt.red5.bak (move working version of OM just in case 
:))\n
-       6) extract downloaded OM to the /opt/red5\n
-       7) ./admin.sh -i -file ~/today_om_backup.zip (or './admin.sh -i -file 
~/today_om_backup.zip --db-type mysql --db-user om_user --db-pass om_user_pass' 
in case of you are using non-default DB )\n
-       8) start OM\n
-    </value>
+    <value>To save time and internet traffic you can use command line admin to 
backup/restore/upgrade:\n 1) go to OM install dir (for ex. /opt/red5) \n 2) 
stop OM (for ex. ./red5-shutdown.sh)\n 3) ./admin.sh -b -file 
~/today_om_backup.zip (create backup of current OM)\n 4) download archive with 
new OM\n 5) mv /opt/red5 /opt.red5.bak (move working version of OM just in case 
:))\n 6) extract downloaded OM to the /opt/red5\n 7) ./admin.sh -i -file 
~/today_om_backup.zip (or './admin.sh -i -file ~/today_om_backup.zip --db-type 
mysql --db-user om_user --db-pass om_user_pass' in case of you are using 
non-default DB )\n 8) start OM\n</value>
   </string>
   <string id="1506" name="public_room_tooltip">
-       <value>Rooms common to all user</value>
+    <value>Rooms common to all user</value>
   </string>
   <string id="1507" name="private_room_tooltip">
-       <value>Rooms common to the current user group</value>
+    <value>Rooms common to the current user group</value>
   </string>
   <string id="1508" name="my_room_tooltip">
-       <value>Rooms of the current user</value>
+    <value>Rooms of the current user</value>
   </string>
   <string id="1509" name="create_new_room">
-       <value>Create/Modify appointment special room</value>
+    <value>Create/Modify appointment special room</value>
   </string>
   <string id="1510" name="multiple_addresses">
-       <value>You can enter multiple addresses in the format: firstname1 
lastname1 &lt;email1&gt;,"firstname2 lastname2" &lt;email2&gt;,'firstname3 
lastname3' &lt;email3&gt;, ...</value>
+    <value>You can enter multiple addresses in the format: firstname1 
lastname1 &lt;email1&gt;,"firstname2 lastname2" &lt;email2&gt;,'firstname3 
lastname3' &lt;email3&gt;, ...</value>
   </string>
   <string id="1511" name="stream_volume">
-       <value>Adjust stream volume</value>
+    <value>Adjust stream volume</value>
   </string>
   <string id="1512" name="microphone_volume">
-       <value>Adjust microphone volume</value>
+    <value>Adjust microphone volume</value>
   </string>
   <string id="1513" name="chat_moderated">
-       <value>Is chat moderated</value>
+    <value>Is chat moderated</value>
   </string>
   <string id="1514" name="chat_moderated">
-       <value>Allow message</value>
+    <value>Allow message</value>
   </string>
   <string id="1515" name="chat_opened">
-       <value>Chat panel opened by default</value>
+    <value>Chat panel opened by default</value>
   </string>
   <string id="1516" name="files_opened">
-       <value>Files panel opened by default</value>
+    <value>Files panel opened by default</value>
   </string>
   <string id="1517" name="server admin section lastping">
-       <value>Last ping</value>
+    <value>Last ping</value>
   </string>
   <string id="1518" name="server admin section lastping info">
-       <value>Every slave sends a ping to the master every 3 seconds 
(configurable). Slave lastPing must be smaller then 1 minute so that the master 
uses the slave.</value>
+    <value>Every slave sends a ping to the master every 3 seconds 
(configurable). Slave lastPing must be smaller then 1 minute so that the master 
uses the slave. "Ping running" shows if the ping is currently running.</value>
   </string>
-  <string id="1519" name="server admin ping failed">
-       <value>Ping failed, could not find server by this name.</value>
+  <string id="1519" name="server admin port">
+    <value>HTTP Port</value>
   </string>
   <string id="1520" name="server admin ping failed">
-       <value>Ping failed, multiple servers found with this name.</value>
+    <value>Ping failed, multiple servers found with this name.</value>
+  </string>
+  <string id="1520" name="server admin user">
+    <value>User (SOAP-Access)</value>
+  </string>
+  <string id="1521" name="server admin password">
+    <value>Password</value>
+  </string>
+  <string id="1522" name="server admin webapp path">
+    <value>Webapp path</value>
+  </string>
+  <string id="1523" name="server admin protocol">
+    <value>Protocol</value>
+  </string>
+  <string id="1524" name="server admin ping running">
+    <value>Ping running</value>
   </string>
 </language>

Added: 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/test/labels/FillLabels.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/test/labels/FillLabels.java?rev=1409138&view=auto
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/test/labels/FillLabels.java
 (added)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/test/labels/FillLabels.java
 Wed Nov 14 10:23:08 2012
@@ -0,0 +1,252 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.test.labels;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.openmeetings.persistence.beans.lang.Fieldlanguagesvalues;
+import org.apache.openmeetings.persistence.beans.lang.Fieldvalues;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.dom4j.Namespace;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.SAXReader;
+import org.dom4j.io.XMLWriter;
+import org.junit.Test;
+
+/**
+ * Syncs all labels from a given master language file to all language files You
+ * can also specify some labels that are overwritten from the master file to 
all
+ * other files
+ * 
+ * @author sebawagner
+ * 
+ */
+public class FillLabels {
+
+       private final String basePath = "./WebContent/languages/";
+
+       private final String masterLangFile = "english.xml";
+
+       private final String[] excludeFiles = { masterLangFile, 
"errorvalues.xml",
+                       "countries.xml", "timezones.xml", "languages.xml" };
+
+       /**
+        * those labels will be overwritten from the master to all language 
files,
+        * other label-id's will be only filled up if missing at the end of the
+        * language file
+        */
+       private final int[] replaceIds = {};
+
+       private final List<Fieldlanguagesvalues> masterLabels = new 
ArrayList<Fieldlanguagesvalues>();
+
+       @Test
+       public void test() {
+
+               try {
+
+                       // Read master file
+                       masterLabels.addAll(parseToLabelsArray(masterLangFile));
+
+                       File languagesFilesFolder = new File(basePath);
+
+                       for (File file : languagesFilesFolder
+                                       .listFiles(new FilenameFilter() {
+                                               public boolean accept(File 
file, String string1) {
+                                                       if 
(!string1.endsWith("xml")) {
+                                                               return false;
+                                                       }
+                                                       for (String 
excludeFileName : excludeFiles) {
+                                                               if 
(string1.equals(excludeFileName)) {
+                                                                       return 
false;
+                                                               }
+                                                       }
+                                                       return true;
+                                               }
+                                       })) {
+
+                               List<Fieldlanguagesvalues> labelsArray = 
parseToLabelsArray(file
+                                               .getName());
+
+                               for (int i = 0; i < masterLabels.size(); i++) {
+                                       boolean isReplaced = false;
+                                       if (i + 1 < labelsArray.size()) {
+                                               for (int replaceId : 
replaceIds) {
+                                                       if (replaceId == 
labelsArray.get(i)
+                                                                       
.getFieldvalues_id().intValue()) {
+                                                               
labelsArray.set(i, masterLabels.get(i));
+                                                               isReplaced = 
true;
+                                                       }
+                                               }
+                                       }
+                                       if (!isReplaced) {
+                                               if (i + 1 < labelsArray.size()) 
{
+                                                       if (!labelsArray
+                                                                       .get(i)
+                                                                       
.getFieldvalues_id()
+                                                                       
.equals(masterLabels.get(i)
+                                                                               
        .getFieldvalues_id())) {
+                                                               throw new 
Exception(
+                                                                               
"Master and fill language has another index in labelid: "
+                                                                               
                + masterLabels.get(i)
+                                                                               
                                .getFieldvalues_id()
+                                                                               
                + " Check file: "
+                                                                               
                + file.getName() + " "
+                                                                               
                + labelsArray.get(i).getValue());
+                                                       }
+                                               } else {
+                                                       
labelsArray.add(masterLabels.get(i));
+                                               }
+                                       }
+                               }
+
+                               OutputStream out = new FileOutputStream(basePath
+                                               + file.getName());
+
+                               this.serializetoXML(out, "UTF-8", 
createDocument(labelsArray));
+
+                       }
+
+               } catch (Exception er) {
+                       er.printStackTrace();
+               }
+
+       }
+
+       /**
+        * parses a given language file to an array of Labels
+        * 
+        * @return
+        * @throws FileNotFoundException
+        * @throws DocumentException
+        */
+       private List<Fieldlanguagesvalues> parseToLabelsArray(String fileName)
+                       throws FileNotFoundException, DocumentException {
+
+               List<Fieldlanguagesvalues> labelsArray = new 
ArrayList<Fieldlanguagesvalues>();
+
+               InputStream is = new FileInputStream(basePath + fileName);
+               SAXReader reader = new SAXReader();
+               Document document = reader.read(is);
+
+               Element root = document.getRootElement();
+
+               for (@SuppressWarnings("unchecked")
+               Iterator<Element> i = root.elementIterator(); i.hasNext();) {
+                       Element itemObject = i.next();
+                       Long fieldvalues_id = Long.valueOf(
+                                       
itemObject.attribute("id").getText()).longValue();
+                       String fieldName = 
itemObject.attribute("name").getText();
+                       String value = itemObject.element("value").getText();
+                       Fieldlanguagesvalues fValue = new 
Fieldlanguagesvalues();
+                       fValue.setFieldvalues_id(fieldvalues_id);
+                       fValue.setValue(value);
+                       Fieldvalues fLabel = new Fieldvalues();
+                       fLabel.setName(fieldName);
+                       fValue.setFieldvalues(fLabel);
+                       labelsArray.add(fValue);
+               }
+
+               return labelsArray;
+       }
+
+       /**
+        * Create the document
+        * 
+        * @param flvList
+        * @return
+        * @throws Exception
+        */
+       private Document createDocument(List<Fieldlanguagesvalues> flvList)
+                       throws Exception {
+
+               Document document = DocumentHelper.createDocument();
+               document.setXMLEncoding("UTF-8");
+               document.addComment(""
+                               + "\n"
+                               + "  Licensed to the Apache Software Foundation 
(ASF) under one\n"
+                               + "  or more contributor license agreements.  
See the NOTICE file\n"
+                               + "  distributed with this work for additional 
information\n"
+                               + "  regarding copyright ownership.  The ASF 
licenses this file\n"
+                               + "  to you under the Apache License, Version 
2.0 (the\n"
+                               + "  \"License\"); you may not use this file 
except in compliance\n"
+                               + "  with the License.  You may obtain a copy 
of the License at\n"
+                               + "  \n"
+                               + "      
http://www.apache.org/licenses/LICENSE-2.0\n";
+                               + "       \n"
+                               + "  Unless required by applicable law or 
agreed to in writing,\n"
+                               + "  software distributed under the License is 
distributed on an\n"
+                               + "  \"AS IS\" BASIS, WITHOUT WARRANTIES OR 
CONDITIONS OF ANY\n"
+                               + "  KIND, either express or implied.  See the 
License for the\n"
+                               + "  specific language governing permissions 
and limitations\n"
+                               + "  under the License.\n"
+                               + "  \n"
+                               + "\n"
+                               + "\n"
+                               + 
"###############################################\n"
+                               + "This File is auto-generated by the 
LanguageEditor \n"
+                               + "to add new Languages or modify/customize it 
use the LanguageEditor \n"
+                               + "see 
http://incubator.apache.org/openmeetings/LanguageEditor.html for Details \n"
+                               + 
"###############################################");
+
+               Element root = document.addElement("language");
+               root.add(new Namespace("xsi",
+                               "http://www.w3.org/2001/XMLSchema-instance";));
+               root.add(new Namespace("noNamespaceSchemaLocation", 
"language.xsd"));
+
+               for (Fieldlanguagesvalues flv : flvList) {
+                       Element eTemp = root.addElement("string")
+                                       .addAttribute("id", 
flv.getFieldvalues_id().toString())
+                                       .addAttribute("name", 
flv.getFieldvalues().getName());
+                       Element value = eTemp.addElement("value");
+                       value.addText(flv.getValue());
+               }
+
+               return document;
+       }
+
+       /**
+        * write XML
+        * 
+        * @param out
+        * @param aEncodingScheme
+        * @param doc
+        * @throws Exception
+        */
+       private void serializetoXML(OutputStream out, String aEncodingScheme,
+                       Document doc) throws Exception {
+               OutputFormat outformat = OutputFormat.createPrettyPrint();
+               outformat.setEncoding(aEncodingScheme);
+               XMLWriter writer = new XMLWriter(out, outformat);
+               writer.write(doc);
+               writer.flush();
+       }
+
+}


Reply via email to