localization demo bezieht sich auf altes stylesheet Konzept, das bereits gelöscht ist.
git-svn-id: https://svn.libreccm.org/ccm/trunk@687 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
bed3eec727
commit
5379c45f03
|
|
@ -1,129 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2.1 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.arsdigita.localization.demo;
|
|
||||||
|
|
||||||
import com.arsdigita.initializer.Configuration;
|
|
||||||
import com.arsdigita.initializer.InitializationException;
|
|
||||||
|
|
||||||
import com.arsdigita.persistence.SessionManager;
|
|
||||||
import com.arsdigita.persistence.TransactionContext;
|
|
||||||
|
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
|
||||||
|
|
||||||
import com.arsdigita.kernel.PackageType;
|
|
||||||
import com.arsdigita.kernel.Stylesheet;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Demonstrate how to add a localization of the Core without having to
|
|
||||||
* modify the Core source code.
|
|
||||||
*
|
|
||||||
* @author Michael Yoon
|
|
||||||
* @version $Revision: #10 $
|
|
||||||
* @since ACS 5.0
|
|
||||||
*/
|
|
||||||
public class Initializer
|
|
||||||
implements com.arsdigita.initializer.Initializer {
|
|
||||||
|
|
||||||
private Configuration m_conf = new Configuration();
|
|
||||||
|
|
||||||
public final static String versionId = "$Id: Initializer.java 287 2005-02-22 00:29:02Z sskracic $";
|
|
||||||
|
|
||||||
private static final Logger s_log =
|
|
||||||
Logger.getLogger(Initializer.class);
|
|
||||||
|
|
||||||
// TODO: Move this constant to a more appropriate location.
|
|
||||||
private final static String SUBSITE_PACKAGE_KEY = "acs-subsite";
|
|
||||||
|
|
||||||
public Configuration getConfiguration() {
|
|
||||||
return m_conf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void startup() {
|
|
||||||
|
|
||||||
String stylesheetPath =
|
|
||||||
"/packages/localization-demo/xsl/login_de.xsl";
|
|
||||||
|
|
||||||
TransactionContext txn =
|
|
||||||
SessionManager.getSession().getTransactionContext();
|
|
||||||
txn.beginTxn();
|
|
||||||
|
|
||||||
PackageType subsitePackage = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
subsitePackage =
|
|
||||||
PackageType.findByKey(SUBSITE_PACKAGE_KEY);
|
|
||||||
|
|
||||||
} catch (DataObjectNotFoundException e) {
|
|
||||||
s_log.warn("Error registering German-localized stylesheet " +
|
|
||||||
"for the ACS login/registration pages: the \"" +
|
|
||||||
SUBSITE_PACKAGE_KEY + "\" PackageType cannot be " +
|
|
||||||
"found.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check to see if this stylesheet has already been
|
|
||||||
// registered.
|
|
||||||
|
|
||||||
boolean isRegistered = false;
|
|
||||||
Stylesheet stylesheet = null;
|
|
||||||
Stylesheet[] stylesheets =
|
|
||||||
subsitePackage.getStylesheets(Locale.GERMAN,
|
|
||||||
"text/html");
|
|
||||||
|
|
||||||
for (int i = 0; i < stylesheets.length; i++) {
|
|
||||||
stylesheet = stylesheets[i];
|
|
||||||
if (stylesheet.getPath().equals(stylesheetPath)) {
|
|
||||||
isRegistered = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isRegistered) {
|
|
||||||
|
|
||||||
s_log.warn
|
|
||||||
("Localization Demo: registering a German-" +
|
|
||||||
"localized stylesheet for ACS login/registration " +
|
|
||||||
"pages...");
|
|
||||||
|
|
||||||
// The stylesheet's outputType property is set to
|
|
||||||
// "text/html" by default.
|
|
||||||
|
|
||||||
stylesheet =
|
|
||||||
Stylesheet.createStylesheet(stylesheetPath,
|
|
||||||
Locale.GERMAN);
|
|
||||||
|
|
||||||
subsitePackage.addStylesheet(stylesheet);
|
|
||||||
|
|
||||||
subsitePackage.save();
|
|
||||||
|
|
||||||
s_log.info
|
|
||||||
("Localization Demo: registration of German-" +
|
|
||||||
"localized stylesheet for ACS login/registration " +
|
|
||||||
"pages completed successfully.");
|
|
||||||
}
|
|
||||||
|
|
||||||
txn.commitTxn();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void shutdown() throws InitializationException {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Localization Demonstration</title>
|
|
||||||
</head>
|
|
||||||
<body bgcolor="white">
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<b>Example</b> A demonstration of how to localize the login and
|
|
||||||
registration pages of the ACS without touching the code. Localization
|
|
||||||
uses German as the target locale, and includes three files:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>a properties file to contain the localized string
|
|
||||||
(<code>src/ui/login/SubsiteResources_de.properties</code>)
|
|
||||||
<li>a localized stylesheet (<code>xsl/login_de.xsl</code>)
|
|
||||||
<li>an <code>Initializer</code> class
|
|
||||||
(<code>src/localization/demo/Initializer.java</code>) to map the
|
|
||||||
stylesheet to the German locale
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
login.workspacePage.title=GERMAN TRANSLATION OF: Your workspace
|
|
||||||
login.badPasswordPage.title=GERMAN TRANSLATION OF: Bad Password
|
|
||||||
login.explainCookiesPage.title=GERMAN TRANSLATION OF: Saving email address and password
|
|
||||||
login.userRegistrationForm.title=GERMAN TRANSLATION OF: Log in
|
|
||||||
login.userRegistrationForm.emailAddressLabel=GERMAN TRANSLATION OF: Your email address:
|
|
||||||
login.userRegistrationForm.passwordLabel=GERMAN TRANSLATION OF: Your password:
|
|
||||||
login.userRegistrationForm.submit=GERMAN TRANSLATION OF: Submit
|
|
||||||
login.userNewForm.title=GERMAN TRANSLATION OF: Register
|
|
||||||
login.userNewForm.securitySectionHeader=GERMAN TRANSLATION OF: <h3>Security</h3>
|
|
||||||
login.userNewForm.securityBlurb=GERMAN TRANSLATION OF: We need a password from you to protect your identity as you contribute to the Q&A, discussion forums, and other community activities on this site.
|
|
||||||
login.userNewForm.passwordLabel=GERMAN TRANSLATION OF: Password:
|
|
||||||
login.userNewForm.passwordLabel=GERMAN TRANSLATION OF: Confirm password:
|
|
||||||
login.userNewForm.passwordBlurb=GERMAN TRANSLATION OF: Leading or trailing spaces will be removed by the server. Don't obsess too much over your choice of password; if you forget it, our server will offer to email it to you.
|
|
||||||
login.userNewForm.enteredEmailAddressLabel=GERMAN TRANSLATION OF: <your email address>
|
|
||||||
login.userNewForm.aboutYouSectionHeader=GERMAN TRANSLATION OF: <h3>About You</h3>
|
|
||||||
login.userNewForm.fullNameBlurb1=GERMAN TRANSLATION OF: We know your email address already:
|
|
||||||
login.userNewForm.fullNameBlurb2=GERMAN TRANSLATION OF: but we need your full name to generate certain kinds of user interface.
|
|
||||||
login.userNewForm.fullNameLabel=GERMAN TRANSLATION OF: Full Name:
|
|
||||||
login.userNewForm.customQuestionLabel=GERMAN TRANSLATION OF: We also need a customized question and answer to reset your password if you forget.<p>Question:
|
|
||||||
login.userNewForm.customAnswerLabel=GERMAN TRANSLATION OF: <br>Answer:
|
|
||||||
login.userNewForm.homePageLabel=GERMAN TRANSLATION OF: If you have a Web site, we'll be able to point searchers there. <p> Personal Home Page URL:
|
|
||||||
login.userNewForm.submit=GERMAN TRANSLATION OF: Submit
|
|
||||||
Loading…
Reference in New Issue