[izpack-devel] Localizing InstallationGroupPanel
miraodb
miraodb at hotmail.com
Wed Oct 11 15:47:33 CEST 2006
Hi Loic,
First of all ,thanks for the patch and the interest you put in IzPack. I've
looked to your code and it seems pretty good. I have however to ask you to
wait a bit till i can commit such thing. The main reason is that a comming
future will probably solve that problem not only for this panel but for all
of them. I'm still on it and i have yet not finish it nor documented it
properly. Once it's there i'll post the whole thing.
Cheers,
Fabrice.
PS: I keep your solution in mind, in case mine doesnt show up... :-(
PS N°2: If anyone is against that idea, say it loud :-)
----- Original Message -----
From: "Loic" <lbndev at yahoo.fr>
To: <izpack-devel at lists.berlios.de>
Sent: Wednesday, October 11, 2006 5:52 AM
Subject: [izpack-devel] Localizing InstallationGroupPanel
Hi,
Looks like the InstallationGroupPanel included in IzPack 3.9 is not
localizable beyond the groups descriptions.
May I suggest the patch below to allow for some more localization (table
colums headers, group names) ?
Thanks,
Loïc
--- InstallationGroupPanel-orig.java 2006-10-02 15:23:20.879057552 +0200
+++ InstallationGroupPanel-modif.java 2006-10-02 15:43:44.785995416 +0200
@@ -325,7 +325,8 @@
if (data == null)
{
String description = getGroupDescription(group);
- data = new GroupData(group, description);
+ String gname = getLocalizedGroupName(group);
+ data = new GroupData(gname, description);
installGroups.put(group, data);
}
}
@@ -399,9 +400,51 @@
return description;
}
+ /**
+ * Look for a key = InstallationGroupPanel.group.[group] entry:
+ * first using idata.langpackgetString(key+".html")
+ * next using idata.langpack.getString(key)
+ * next using idata.getVariable(key)
+ * lastly, defaulting to group
+ * @param group - the installation group name
+ * @return the localized group name
+ */
+ protected String getLocalizedGroupName(String group)
+ {
+ String gname = null;
+ String key = "InstallationGroupPanel.group." + group;
+ if( idata.langpack != null )
+ {
+ String htmlKey = key+".html";
+ String html = idata.langpack.getString(htmlKey);
+ // This will equal the key if there is no entry
+ if( htmlKey.equalsIgnoreCase(html) )
+ gname = idata.langpack.getString(key);
+ else
+ gname = html;
+ }
+ if (gname == null)
+ gname = idata.getVariable(key);
+ if (gname == null)
+ gname = group;
+ try
+ {
+ gname = URLDecoder.decode(description, "UTF-8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ emitWarning("Failed to convert localized group name",
e.getMessage());
+ }
+
+ return gname;
+ }
+
protected TableModel getModel(HashMap groupData)
{
- String[] columns = { "Selected", "InstallType", "Size"};
+ String[] columns = {
idata.langpack.getString("InstallationGroupPanel.header.selection"),
+
idata.langpack.getString("InstallationGroupPanel.header.description"),
+
idata.langpack.getString("InstallationGroupPanel.header.size"};
+
DefaultTableModel model = new DefaultTableModel (columns, 0)
{
public boolean isCellEditable (int row, int column)
___________________________________________________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Demandez à ceux qui savent sur Yahoo! Questions/Réponses
http://fr.answers.yahoo.com
--------------------------------------------------------------------------------
> _______________________________________________
> izpack-devel mailing list
> izpack-devel at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/izpack-devel
>
More information about the izpack-devel
mailing list