mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 05:23:14 +00:00
fixed line endings
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1975 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
License
|
License
|
||||||
|
|
||||||
Copyright (c) 2000 - 2006 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
|
Copyright (c) 2000 - 2006 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
License
|
License
|
||||||
|
|
||||||
Copyright (c) 2000 - 2006 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
|
Copyright (c) 2000 - 2006 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,455 +1,455 @@
|
|||||||
/*
|
/*
|
||||||
* I18nUtil.java
|
* I18nUtil.java
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
|
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
|
||||||
* Institute of Technology. All rights reserved.
|
* Institute of Technology. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
* met:
|
* met:
|
||||||
*
|
*
|
||||||
* - Redistributions of source code must retain the above copyright
|
* - Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* - Redistributions in binary form must reproduce the above copyright
|
* - Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* - Neither the name of the Hewlett-Packard Company nor the name of the
|
* - Neither the name of the Hewlett-Packard Company nor the name of the
|
||||||
* Massachusetts Institute of Technology nor the names of their
|
* Massachusetts Institute of Technology nor the names of their
|
||||||
* contributors may be used to endorse or promote products derived from
|
* contributors may be used to endorse or promote products derived from
|
||||||
* this software without specific prior written permission.
|
* this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
* DAMAGE.
|
* DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.dspace.core;
|
package org.dspace.core;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* I18nUtil.java
|
* I18nUtil.java
|
||||||
*
|
*
|
||||||
* Some Utilities for i18n Support.
|
* Some Utilities for i18n Support.
|
||||||
* - getting the default Locale for this DSpace Instance
|
* - getting the default Locale for this DSpace Instance
|
||||||
* - getting all supported Locales for this DSpace Instance
|
* - getting all supported Locales for this DSpace Instance
|
||||||
* - getting email template, help file, input forms for a given Locale
|
* - getting email template, help file, input forms for a given Locale
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Bernadette Schlonsok and Claudia Juergen
|
* @author Bernadette Schlonsok and Claudia Juergen
|
||||||
*
|
*
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class I18nUtil
|
public class I18nUtil
|
||||||
{
|
{
|
||||||
// the default Locale of this DSpace Instance
|
// the default Locale of this DSpace Instance
|
||||||
public static final Locale DEFAULTLOCALE = getDefaultLocale();
|
public static final Locale DEFAULTLOCALE = getDefaultLocale();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the default locale as defined in dspace.cfg If no default locale is
|
* Gets the default locale as defined in dspace.cfg If no default locale is
|
||||||
* defined, the Locale of the JVM is used
|
* defined, the Locale of the JVM is used
|
||||||
*
|
*
|
||||||
* @return defaultLocale
|
* @return defaultLocale
|
||||||
* the default Locale for this DSpace instance
|
* the default Locale for this DSpace instance
|
||||||
*/
|
*/
|
||||||
private static Locale getDefaultLocale()
|
private static Locale getDefaultLocale()
|
||||||
{
|
{
|
||||||
Locale defaultLocale = null;
|
Locale defaultLocale = null;
|
||||||
if ((ConfigurationManager.getProperty("default.locale") != null)
|
if ((ConfigurationManager.getProperty("default.locale") != null)
|
||||||
&& (ConfigurationManager.getProperty("default.locale") != ""))
|
&& (ConfigurationManager.getProperty("default.locale") != ""))
|
||||||
{
|
{
|
||||||
StringTokenizer configDefaultLocale = new StringTokenizer(
|
StringTokenizer configDefaultLocale = new StringTokenizer(
|
||||||
ConfigurationManager.getProperty("default.locale"));
|
ConfigurationManager.getProperty("default.locale"));
|
||||||
int countTokens = configDefaultLocale.countTokens();
|
int countTokens = configDefaultLocale.countTokens();
|
||||||
switch (countTokens)
|
switch (countTokens)
|
||||||
{
|
{
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
defaultLocale = new Locale(configDefaultLocale.nextToken()
|
defaultLocale = new Locale(configDefaultLocale.nextToken()
|
||||||
.trim());
|
.trim());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
defaultLocale = new Locale(configDefaultLocale.nextToken()
|
defaultLocale = new Locale(configDefaultLocale.nextToken()
|
||||||
.trim(), configDefaultLocale.nextToken().trim());
|
.trim(), configDefaultLocale.nextToken().trim());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
defaultLocale = new Locale(configDefaultLocale.nextToken()
|
defaultLocale = new Locale(configDefaultLocale.nextToken()
|
||||||
.trim(), configDefaultLocale.nextToken().trim(),
|
.trim(), configDefaultLocale.nextToken().trim(),
|
||||||
configDefaultLocale.nextToken().trim());
|
configDefaultLocale.nextToken().trim());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (defaultLocale == null)
|
if (defaultLocale == null)
|
||||||
{
|
{
|
||||||
// use the Locale of the JVM
|
// use the Locale of the JVM
|
||||||
defaultLocale = Locale.getDefault();
|
defaultLocale = Locale.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultLocale;
|
return defaultLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the available Locales for the User Interface as defined in dspace.cfg
|
* get the available Locales for the User Interface as defined in dspace.cfg
|
||||||
* returns an array of Locales or null
|
* returns an array of Locales or null
|
||||||
*
|
*
|
||||||
* @return an array of supported Locales or null
|
* @return an array of supported Locales or null
|
||||||
*/
|
*/
|
||||||
public static Locale[] getSupportedLocales()
|
public static Locale[] getSupportedLocales()
|
||||||
{
|
{
|
||||||
Locale[] availableLocales;
|
Locale[] availableLocales;
|
||||||
|
|
||||||
if (ConfigurationManager.getProperty("webui.supported.locales") != null)
|
if (ConfigurationManager.getProperty("webui.supported.locales") != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
StringTokenizer configuredLocales = new StringTokenizer(
|
StringTokenizer configuredLocales = new StringTokenizer(
|
||||||
ConfigurationManager.getProperty("webui.supported.locales"),
|
ConfigurationManager.getProperty("webui.supported.locales"),
|
||||||
",");
|
",");
|
||||||
availableLocales = new Locale[configuredLocales
|
availableLocales = new Locale[configuredLocales
|
||||||
.countTokens()];
|
.countTokens()];
|
||||||
|
|
||||||
while (configuredLocales.hasMoreTokens())
|
while (configuredLocales.hasMoreTokens())
|
||||||
{
|
{
|
||||||
StringTokenizer localeElements = new StringTokenizer(
|
StringTokenizer localeElements = new StringTokenizer(
|
||||||
configuredLocales.nextToken().trim(), "_");
|
configuredLocales.nextToken().trim(), "_");
|
||||||
int countTokens = localeElements.countTokens();
|
int countTokens = localeElements.countTokens();
|
||||||
switch (countTokens)
|
switch (countTokens)
|
||||||
{
|
{
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
availableLocales[configuredLocales.countTokens()] = new Locale(
|
availableLocales[configuredLocales.countTokens()] = new Locale(
|
||||||
localeElements.nextToken().trim());
|
localeElements.nextToken().trim());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
availableLocales[configuredLocales.countTokens()] = new Locale(
|
availableLocales[configuredLocales.countTokens()] = new Locale(
|
||||||
localeElements.nextToken().trim(), localeElements
|
localeElements.nextToken().trim(), localeElements
|
||||||
.nextToken().trim());
|
.nextToken().trim());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
availableLocales[configuredLocales.countTokens()] = new Locale(
|
availableLocales[configuredLocales.countTokens()] = new Locale(
|
||||||
localeElements.nextToken().trim(), localeElements
|
localeElements.nextToken().trim(), localeElements
|
||||||
.nextToken().trim(), localeElements
|
.nextToken().trim(), localeElements
|
||||||
.nextToken().trim());
|
.nextToken().trim());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
availableLocales = new Locale[1];
|
availableLocales = new Locale[1];
|
||||||
availableLocales[0] = DEFAULTLOCALE;
|
availableLocales[0] = DEFAULTLOCALE;
|
||||||
}
|
}
|
||||||
return availableLocales;
|
return availableLocales;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the appropriate supported Locale according for a given Locale If
|
* Gets the appropriate supported Locale according for a given Locale If
|
||||||
* no appropriate supported locale is found, the DEFAULTLOCALE is used
|
* no appropriate supported locale is found, the DEFAULTLOCALE is used
|
||||||
*
|
*
|
||||||
* @param locale
|
* @param locale
|
||||||
* Locale to find the corresponding Locale
|
* Locale to find the corresponding Locale
|
||||||
* @return supportedLocale
|
* @return supportedLocale
|
||||||
* Locale for session according to locales supported by this DSpace instance as set in dspace.cfg
|
* Locale for session according to locales supported by this DSpace instance as set in dspace.cfg
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static Locale getSupportedLocale(Locale locale)
|
public static Locale getSupportedLocale(Locale locale)
|
||||||
{
|
{
|
||||||
|
|
||||||
Locale[] availableLocales = getSupportedLocales();
|
Locale[] availableLocales = getSupportedLocales();
|
||||||
boolean isSupported = false;
|
boolean isSupported = false;
|
||||||
Locale supportedLocale = null;
|
Locale supportedLocale = null;
|
||||||
String testLocale = "";
|
String testLocale = "";
|
||||||
if (availableLocales == null)
|
if (availableLocales == null)
|
||||||
{
|
{
|
||||||
supportedLocale = DEFAULTLOCALE;
|
supportedLocale = DEFAULTLOCALE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!locale.getVariant().equals(""))
|
if (!locale.getVariant().equals(""))
|
||||||
{
|
{
|
||||||
testLocale = locale.toString();
|
testLocale = locale.toString();
|
||||||
for (int i = 0; i < availableLocales.length; i++)
|
for (int i = 0; i < availableLocales.length; i++)
|
||||||
{
|
{
|
||||||
if (testLocale.equalsIgnoreCase(availableLocales[i]
|
if (testLocale.equalsIgnoreCase(availableLocales[i]
|
||||||
.toString()))
|
.toString()))
|
||||||
{
|
{
|
||||||
isSupported = true;
|
isSupported = true;
|
||||||
supportedLocale = availableLocales[i];
|
supportedLocale = availableLocales[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(isSupported && locale.getCountry().equals("")))
|
if (!(isSupported && locale.getCountry().equals("")))
|
||||||
{
|
{
|
||||||
testLocale = locale.getLanguage() + "_"
|
testLocale = locale.getLanguage() + "_"
|
||||||
+ locale.getCountry();
|
+ locale.getCountry();
|
||||||
|
|
||||||
for (int i = 0; i < availableLocales.length; i++)
|
for (int i = 0; i < availableLocales.length; i++)
|
||||||
{
|
{
|
||||||
if (testLocale.equalsIgnoreCase(availableLocales[i]
|
if (testLocale.equalsIgnoreCase(availableLocales[i]
|
||||||
.toString()))
|
.toString()))
|
||||||
{
|
{
|
||||||
isSupported = true;
|
isSupported = true;
|
||||||
supportedLocale = availableLocales[i];
|
supportedLocale = availableLocales[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!isSupported)
|
if (!isSupported)
|
||||||
{
|
{
|
||||||
testLocale = locale.getLanguage();
|
testLocale = locale.getLanguage();
|
||||||
|
|
||||||
for (int i = 0; i < availableLocales.length; i++)
|
for (int i = 0; i < availableLocales.length; i++)
|
||||||
{
|
{
|
||||||
if (testLocale.equalsIgnoreCase(availableLocales[i]
|
if (testLocale.equalsIgnoreCase(availableLocales[i]
|
||||||
.toString()))
|
.toString()))
|
||||||
{
|
{
|
||||||
isSupported = true;
|
isSupported = true;
|
||||||
supportedLocale = availableLocales[i];
|
supportedLocale = availableLocales[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isSupported)
|
if (!isSupported)
|
||||||
{
|
{
|
||||||
supportedLocale = DEFAULTLOCALE;
|
supportedLocale = DEFAULTLOCALE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return supportedLocale;
|
return supportedLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the appropriate localized version of input-forms.xml according to language settings
|
* Get the appropriate localized version of input-forms.xml according to language settings
|
||||||
*
|
*
|
||||||
* @param locale
|
* @param locale
|
||||||
* Locale, the local to get the input-forms.xml for
|
* Locale, the local to get the input-forms.xml for
|
||||||
* @return String - localized filename for input-forms.xml
|
* @return String - localized filename for input-forms.xml
|
||||||
*/
|
*/
|
||||||
public static String getInputFormsFileName(Locale locale)
|
public static String getInputFormsFileName(Locale locale)
|
||||||
{
|
{
|
||||||
/** Name of the form definition XML file */
|
/** Name of the form definition XML file */
|
||||||
String fileName = "";
|
String fileName = "";
|
||||||
final String FORM_DEF_FILE = "input-forms";
|
final String FORM_DEF_FILE = "input-forms";
|
||||||
final String FILE_TYPE = ".xml";
|
final String FILE_TYPE = ".xml";
|
||||||
String defsFilename = ConfigurationManager.getProperty("dspace.dir")
|
String defsFilename = ConfigurationManager.getProperty("dspace.dir")
|
||||||
+ File.separator + "config" + File.separator + FORM_DEF_FILE;
|
+ File.separator + "config" + File.separator + FORM_DEF_FILE;
|
||||||
fileName = getFilename(locale, defsFilename, FILE_TYPE);
|
fileName = getFilename(locale, defsFilename, FILE_TYPE);
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* et the i18n message string for a given key and use the default Locale
|
* et the i18n message string for a given key and use the default Locale
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* String - name of the key to get the message for
|
* String - name of the key to get the message for
|
||||||
*
|
*
|
||||||
* @return message
|
* @return message
|
||||||
* String of the message
|
* String of the message
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static String getMessage(String key) throws MissingResourceException
|
public static String getMessage(String key) throws MissingResourceException
|
||||||
{
|
{
|
||||||
|
|
||||||
String message = getMessage(key.trim(), DEFAULTLOCALE);
|
String message = getMessage(key.trim(), DEFAULTLOCALE);
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the i18n message string for a given key and locale
|
* Get the i18n message string for a given key and locale
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* String - name of the key to get the message for
|
* String - name of the key to get the message for
|
||||||
* @param locale
|
* @param locale
|
||||||
* Locale, to get the message for
|
* Locale, to get the message for
|
||||||
*
|
*
|
||||||
* @return message
|
* @return message
|
||||||
* String of the message
|
* String of the message
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static String getMessage(String key, Locale locale) throws MissingResourceException
|
public static String getMessage(String key, Locale locale) throws MissingResourceException
|
||||||
{
|
{
|
||||||
String message = "";
|
String message = "";
|
||||||
if (locale == null)
|
if (locale == null)
|
||||||
{
|
{
|
||||||
locale = DEFAULTLOCALE;
|
locale = DEFAULTLOCALE;
|
||||||
}
|
}
|
||||||
ResourceBundle messages = ResourceBundle.getBundle("Messages", locale);
|
ResourceBundle messages = ResourceBundle.getBundle("Messages", locale);
|
||||||
message = messages.getString(key.trim());
|
message = messages.getString(key.trim());
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the i18n message string for a given key and locale
|
* Get the i18n message string for a given key and locale
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* String - name of the key to get the message for
|
* String - name of the key to get the message for
|
||||||
* @param locale
|
* @param locale
|
||||||
* Locale, to get the message for
|
* Locale, to get the message for
|
||||||
*
|
*
|
||||||
* @return message
|
* @return message
|
||||||
* String of the message
|
* String of the message
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static String getMessage(String key, Context c) throws MissingResourceException
|
public static String getMessage(String key, Context c) throws MissingResourceException
|
||||||
{
|
{
|
||||||
String message = getMessage(key.trim(), c.getCurrentLocale());
|
String message = getMessage(key.trim(), c.getCurrentLocale());
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the appropriate localized version of the default.license according to language settings
|
* Get the appropriate localized version of the default.license according to language settings
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context
|
||||||
* the current DSpace context
|
* the current DSpace context
|
||||||
* @return fileName
|
* @return fileName
|
||||||
* String - localized filename for default.license
|
* String - localized filename for default.license
|
||||||
*/
|
*/
|
||||||
public static String getDefaultLicense(Context context)
|
public static String getDefaultLicense(Context context)
|
||||||
{
|
{
|
||||||
Locale locale = context.getCurrentLocale();
|
Locale locale = context.getCurrentLocale();
|
||||||
String fileName = "";
|
String fileName = "";
|
||||||
/** Name of the default license */
|
/** Name of the default license */
|
||||||
final String DEF_LIC_FILE = "default";
|
final String DEF_LIC_FILE = "default";
|
||||||
final String FILE_TYPE = ".license";
|
final String FILE_TYPE = ".license";
|
||||||
String defsFilename = ConfigurationManager.getProperty("dspace.dir")
|
String defsFilename = ConfigurationManager.getProperty("dspace.dir")
|
||||||
+ File.separator + "config" + File.separator + DEF_LIC_FILE;
|
+ File.separator + "config" + File.separator + DEF_LIC_FILE;
|
||||||
|
|
||||||
fileName = getFilename(locale, defsFilename, FILE_TYPE);
|
fileName = getFilename(locale, defsFilename, FILE_TYPE);
|
||||||
|
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the appropriate localized version of a file according to language settings
|
* Get the appropriate localized version of a file according to language settings
|
||||||
* e. g. help files in jsp/help/
|
* e. g. help files in jsp/help/
|
||||||
*
|
*
|
||||||
* @param locale
|
* @param locale
|
||||||
* Locale to get the file for
|
* Locale to get the file for
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* String fileName, to get the localized file for
|
* String fileName, to get the localized file for
|
||||||
* @param fileType
|
* @param fileType
|
||||||
* String file extension
|
* String file extension
|
||||||
* @return localizedFileName
|
* @return localizedFileName
|
||||||
* String - localized filename
|
* String - localized filename
|
||||||
*/
|
*/
|
||||||
private static String getFilename(Locale locale, String fileName, String fileType)
|
private static String getFilename(Locale locale, String fileName, String fileType)
|
||||||
{
|
{
|
||||||
String localizedFileName = null;
|
String localizedFileName = null;
|
||||||
boolean fileFound = false;
|
boolean fileFound = false;
|
||||||
// with Language, Country, Variant
|
// with Language, Country, Variant
|
||||||
String fileNameLCV = null;
|
String fileNameLCV = null;
|
||||||
// with Language, Country
|
// with Language, Country
|
||||||
String fileNameLC = null;
|
String fileNameLC = null;
|
||||||
// with Language
|
// with Language
|
||||||
String fileNameL = null;
|
String fileNameL = null;
|
||||||
fileNameL = fileName + "_" + locale.getLanguage();
|
fileNameL = fileName + "_" + locale.getLanguage();
|
||||||
|
|
||||||
if (fileType == null)
|
if (fileType == null)
|
||||||
{
|
{
|
||||||
fileType = "";
|
fileType = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!("".equals(locale.getCountry())))
|
if (!("".equals(locale.getCountry())))
|
||||||
{
|
{
|
||||||
fileNameLC = fileName + "_" + locale.getLanguage() + "_"
|
fileNameLC = fileName + "_" + locale.getLanguage() + "_"
|
||||||
+ locale.getCountry();
|
+ locale.getCountry();
|
||||||
|
|
||||||
if (!("".equals(locale.getVariant())))
|
if (!("".equals(locale.getVariant())))
|
||||||
{
|
{
|
||||||
fileNameLCV = fileName + "_" + locale.getLanguage() + "_"
|
fileNameLCV = fileName + "_" + locale.getLanguage() + "_"
|
||||||
+ locale.getCountry() + "_" + locale.getVariant();
|
+ locale.getCountry() + "_" + locale.getVariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileNameLCV != null && !fileFound)
|
if (fileNameLCV != null && !fileFound)
|
||||||
{
|
{
|
||||||
File fileTmp = new File(fileNameLCV + fileType);
|
File fileTmp = new File(fileNameLCV + fileType);
|
||||||
if (fileTmp.exists())
|
if (fileTmp.exists())
|
||||||
{
|
{
|
||||||
fileFound = true;
|
fileFound = true;
|
||||||
localizedFileName = fileNameLCV + fileType;
|
localizedFileName = fileNameLCV + fileType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileNameLC != null && !fileFound)
|
if (fileNameLC != null && !fileFound)
|
||||||
{
|
{
|
||||||
File fileTmp = new File(fileNameLC + fileType);
|
File fileTmp = new File(fileNameLC + fileType);
|
||||||
if (fileTmp.exists())
|
if (fileTmp.exists())
|
||||||
{
|
{
|
||||||
fileFound = true;
|
fileFound = true;
|
||||||
localizedFileName = fileNameLC + fileType;
|
localizedFileName = fileNameLC + fileType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileNameL != null && !fileFound)
|
if (fileNameL != null && !fileFound)
|
||||||
{
|
{
|
||||||
File fileTmp = new File(fileNameL + fileType);
|
File fileTmp = new File(fileNameL + fileType);
|
||||||
if (fileTmp.exists())
|
if (fileTmp.exists())
|
||||||
{
|
{
|
||||||
fileFound = true;
|
fileFound = true;
|
||||||
localizedFileName = fileNameL + fileType;
|
localizedFileName = fileNameL + fileType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fileFound)
|
if (!fileFound)
|
||||||
{
|
{
|
||||||
localizedFileName = fileName + fileType;
|
localizedFileName = fileName + fileType;
|
||||||
}
|
}
|
||||||
return localizedFileName;
|
return localizedFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the appropriate localized version of an email template according to language settings
|
* Get the appropriate localized version of an email template according to language settings
|
||||||
*
|
*
|
||||||
* @param locale
|
* @param locale
|
||||||
* Locale for this request
|
* Locale for this request
|
||||||
* @param name
|
* @param name
|
||||||
* String - base name of the email template
|
* String - base name of the email template
|
||||||
* @return templateName
|
* @return templateName
|
||||||
* String - localized filename of an email template
|
* String - localized filename of an email template
|
||||||
*/
|
*/
|
||||||
public static String getEmailFilename(Locale locale, String name)
|
public static String getEmailFilename(Locale locale, String name)
|
||||||
{
|
{
|
||||||
String templateName = "";
|
String templateName = "";
|
||||||
String templateFile = ConfigurationManager.getProperty("dspace.dir")
|
String templateFile = ConfigurationManager.getProperty("dspace.dir")
|
||||||
+ File.separator + "config" + File.separator + "emails"
|
+ File.separator + "config" + File.separator + "emails"
|
||||||
+ File.separator + name;
|
+ File.separator + name;
|
||||||
|
|
||||||
templateName = getFilename(locale, templateFile, "");
|
templateName = getFilename(locale, templateFile, "");
|
||||||
return templateName;
|
return templateName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,53 +1,53 @@
|
|||||||
--
|
--
|
||||||
-- database_schema_14-15.sql
|
-- database_schema_14-15.sql
|
||||||
--
|
--
|
||||||
-- Version: $$
|
-- Version: $$
|
||||||
--
|
--
|
||||||
-- Date: $Date:$
|
-- Date: $Date:$
|
||||||
--
|
--
|
||||||
-- Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
|
-- Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
|
||||||
-- Institute of Technology. All rights reserved.
|
-- Institute of Technology. All rights reserved.
|
||||||
--
|
--
|
||||||
-- Redistribution and use in source and binary forms, with or without
|
-- Redistribution and use in source and binary forms, with or without
|
||||||
-- modification, are permitted provided that the following conditions are
|
-- modification, are permitted provided that the following conditions are
|
||||||
-- met:
|
-- met:
|
||||||
--
|
--
|
||||||
-- - Redistributions of source code must retain the above copyright
|
-- - Redistributions of source code must retain the above copyright
|
||||||
-- notice, this list of conditions and the following disclaimer.
|
-- notice, this list of conditions and the following disclaimer.
|
||||||
--
|
--
|
||||||
-- - Redistributions in binary form must reproduce the above copyright
|
-- - Redistributions in binary form must reproduce the above copyright
|
||||||
-- notice, this list of conditions and the following disclaimer in the
|
-- notice, this list of conditions and the following disclaimer in the
|
||||||
-- documentation and/or other materials provided with the distribution.
|
-- documentation and/or other materials provided with the distribution.
|
||||||
--
|
--
|
||||||
-- - Neither the name of the Hewlett-Packard Company nor the name of the
|
-- - Neither the name of the Hewlett-Packard Company nor the name of the
|
||||||
-- Massachusetts Institute of Technology nor the names of their
|
-- Massachusetts Institute of Technology nor the names of their
|
||||||
-- contributors may be used to endorse or promote products derived from
|
-- contributors may be used to endorse or promote products derived from
|
||||||
-- this software without specific prior written permission.
|
-- this software without specific prior written permission.
|
||||||
--
|
--
|
||||||
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
-- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
-- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
-- HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
-- HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
-- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
-- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
-- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
-- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
-- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
-- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
-- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
-- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||||
-- USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
-- USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
-- DAMAGE.
|
-- DAMAGE.
|
||||||
|
|
||||||
--
|
--
|
||||||
-- SQL commands to upgrade the database schema of a live DSpace 1.3 or 1.3.x
|
-- SQL commands to upgrade the database schema of a live DSpace 1.3 or 1.3.x
|
||||||
-- to the DSpace 1.4 database schema
|
-- to the DSpace 1.4 database schema
|
||||||
--
|
--
|
||||||
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
||||||
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
||||||
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
-- New Column language language in EPerson
|
-- New Column language language in EPerson
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
|
|
||||||
alter table eperson add column language VARCHAR(64);
|
alter table eperson add column language VARCHAR(64);
|
||||||
update eperson set language = 'en';
|
update eperson set language = 'en';
|
||||||
|
Reference in New Issue
Block a user