Return-Path: Delivered-To: apmail-felix-dev-archive@www.apache.org Received: (qmail 81975 invoked from network); 5 Mar 2010 15:53:05 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Mar 2010 15:53:05 -0000 Received: (qmail 25043 invoked by uid 500); 5 Mar 2010 15:52:51 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 25001 invoked by uid 500); 5 Mar 2010 15:52:51 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 24993 invoked by uid 99); 5 Mar 2010 15:52:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Mar 2010 15:52:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Mar 2010 15:52:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4B907234C4CE for ; Fri, 5 Mar 2010 15:52:27 +0000 (UTC) Message-ID: <233379184.99941267804347307.JavaMail.jira@brutus.apache.org> Date: Fri, 5 Mar 2010 15:52:27 +0000 (UTC) From: "Felix Meschberger (JIRA)" To: dev@felix.apache.org Subject: [jira] Assigned: (FELIX-2158) Localization of plugin titles In-Reply-To: <63610404.10111267549527214.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/FELIX-2158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Felix Meschberger reassigned FELIX-2158: ---------------------------------------- Assignee: Felix Meschberger > Localization of plugin titles > ----------------------------- > > Key: FELIX-2158 > URL: https://issues.apache.org/jira/browse/FELIX-2158 > Project: Felix > Issue Type: Improvement > Components: Web Console > Reporter: Valentin Valchev > Assignee: Felix Meschberger > Attachments: FELIX-2158-2.patch, FELIX-2158.patch > > > We have added localization support, but there is one thing missing - the titles of the plugins, that are rendered on top. > So now, even though the plugins are completely localized, the navigation between the plugins is not. However, we need to keep the web console compatible with the old API, so the change should be transparent. > I've been thinking about the problem and came to the following solution: > when request is made, the webconsole will: > 1. obtain the resource bundle for plugins > 2. for each plugin > 3. get the localized title, which is a resource key .pluginTitle > 4. if the localized title doesn't exist - then use the default title > 5. fill in the labelMap table > the reason for using .pluginTitle instead of some other constant name is that a bundle can provide more than one plugins, as example webconsole itself. In this case we need to provide titles for all plugins and this involves the label. > This can be achieved easily by adding the following method in OsgiManager: > private final Map localizedLabelMap(final Locale locale) > { > Map map = new HashMap(); > ResourceBundle resourceBundle; > AbstractWebConsolePlugin plugin; > String label; > String title; > for (Iterator pi = plugins.values().iterator(); pi.hasNext();) > { > plugin = (AbstractWebConsolePlugin) pi.next(); > resourceBundle = resourceBundleManager.getResourceBundle(plugin.getBundle(), > locale); > label = plugin.getLabel(); > title = plugin.getTitle(); > try > { > final String res = plugin.getLabel() + ".pluginTitle"; > title = resourceBundle.getString(res); > // our Resource Bundle doesn't throw exception, so if > // the value is same as the property key - revert to > // the original title > if (title.equals(res)) > { > title = plugin.getTitle(); > } > } > catch (Throwable e) > { > /* ignore missing resource - use default title */ > } > map.put(label, title); > } > return map; > } > and modify the service() method as follows: > Map labelMap = localizedLabelMap(request.getLocale()); > // the official request attributes > req.setAttribute( WebConsoleConstants.ATTR_LABEL_MAP, labelMap ); -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.