Norwegian Nynorsk translation + a few bugfixes
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@75 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
e4eafbf87c
commit
b415705e47
15 changed files with 338 additions and 24 deletions
|
@ -16,11 +16,11 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2009 by Henrik Just
|
||||
* Copyright: 2002-2010 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2009-06-05)
|
||||
* Version 1.2 (2010-10-27)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -89,11 +89,25 @@ public class ExportNameCollection{
|
|||
}
|
||||
}
|
||||
String sExportName=outbuf.toString();
|
||||
// the result may exist in the collecion; add a's at the end
|
||||
while (exportNames.containsValue(sExportName)){
|
||||
sExportName+="a";
|
||||
if (sExportName.length()==0) {
|
||||
// Do not accept empty export names
|
||||
sExportName = "qwerty";
|
||||
}
|
||||
if (!exportNames.containsValue(sExportName)) {
|
||||
// Everything's fine, we can use the stripped name directly
|
||||
exportNames.put(sName,sExportName);
|
||||
}
|
||||
else {
|
||||
// Otherwise add letters at the end until a unique export name is found
|
||||
int i=1;
|
||||
while (true) {
|
||||
String sSuffix = Misc.int2alph(i++, false);
|
||||
if (!exportNames.containsValue(sExportName+sSuffix)) {
|
||||
exportNames.put(sName,sExportName+sSuffix);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
exportNames.put(sName,sExportName);
|
||||
}
|
||||
|
||||
public String getExportName(String sName) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-05-17)
|
||||
* Version 1.2 (2010-10-27)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -34,6 +34,7 @@ import java.io.UnsupportedEncodingException;
|
|||
import java.lang.Math;
|
||||
import java.net.URLEncoder;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Arrays;
|
||||
//import java.util.Hashtable;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -53,6 +54,7 @@ public class Misc{
|
|||
}
|
||||
|
||||
public static final String int2roman(int number) {
|
||||
assert number>0; // Only works for positive numbers!
|
||||
StringBuffer roman=new StringBuffer();
|
||||
while (number>=1000) { roman.append('m'); number-=1000; }
|
||||
if (number>=900) { roman.append("cm"); number-=900; }
|
||||
|
@ -79,8 +81,26 @@ public class Misc{
|
|||
}
|
||||
|
||||
public static final String int2alph(int number, boolean bLetterSync) {
|
||||
// TODO: Handle overflow/lettersync
|
||||
return new Character((char) (number+96)).toString();
|
||||
assert number>0; // Only works for positive numbers!
|
||||
if (bLetterSync) {
|
||||
char[] chars = new char[(number-1)/26+1]; // Repeat the character this number of times
|
||||
Arrays.fill(chars, (char) ((number-1) % 26+97)); // Use this character
|
||||
return String.valueOf(chars);
|
||||
}
|
||||
else {
|
||||
int n=number-1;
|
||||
// Least significant digit is special because a is treated as zero here!
|
||||
int m = n % 26;
|
||||
String sNumber = Character.toString((char) (m+97));
|
||||
n = (n-m)/26;
|
||||
// For the more significant digits, a is treated as one!
|
||||
while (n>0) {
|
||||
m = n % 26; // Calculate new least significant digit
|
||||
sNumber = ((char) (m+96))+sNumber;
|
||||
n = (n-m)/26;
|
||||
}
|
||||
return sNumber;
|
||||
}
|
||||
}
|
||||
|
||||
public static final String int2Alph(int number, boolean bLetterSync) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue