eclipse plugin: Externalize some strings

This commit is contained in:
Timotei Dolean 2011-07-06 16:51:18 +00:00
parent 0f80beb9d7
commit f649533361
13 changed files with 108 additions and 62 deletions

View file

@ -261,7 +261,8 @@ public class Messages extends NLS
public static String ScenarioPage2_4;
public static String SchemaFactory_1;
public static String SchemaFactory_4;
public static String SchemaParser_1;
public static String SchemaParser_0;
public static String SchemaParser_1;
public static String SchemaParser_18;
public static String SchemaParser_2;
public static String SchemaParser_25;
@ -274,7 +275,23 @@ public class Messages extends NLS
public static String TemplateProvider_15;
public static String UploadAddon_0;
public static String UploadAddon_1;
public static String WesnothPreferencesPage_0;
public static String WesnothInstallsPage_0;
public static String WesnothInstallsPage_10;
public static String WesnothInstallsPage_11;
public static String WesnothInstallsPage_12;
public static String WesnothInstallsPage_13;
public static String WesnothInstallsPage_19;
public static String WesnothInstallsPage_20;
public static String WesnothInstallsPage_21;
public static String WesnothInstallsPage_5;
public static String WesnothInstallsPage_6;
public static String WesnothInstallsPage_7;
public static String WesnothInstallsPage_8;
public static String WesnothInstallsPage_9;
public static String WesnothInstallsUtils_1;
public static String WesnothInstallsUtils_2;
public static String WesnothInstallsUtils_3;
public static String WesnothPreferencesPage_0;
public static String WesnothPreferencesPage_10;
public static String WesnothPreferencesPage_11;
public static String WesnothPreferencesPage_12;
@ -298,6 +315,9 @@ public class Messages extends NLS
public static String WesnothProjectBuilder_5;
public static String WesnothProjectBuilder_6;
public static String WesnothProjectBuilder_8;
public static String WesnothProjectPage_0;
public static String WesnothProjectPage_1;
public static String WesnothProjectPage_2;
public static String WesnothProjectReport_0;
public static String WesnothProjectReport_4;
public static String WizardGeneratorPage404_1;

View file

@ -70,7 +70,7 @@ public class DependencyTreeBuilder implements Serializable
while( containers.isEmpty( ) == false ) {
IContainer container = containers.poll( );
IResource main_cfg = container.findMember( "_main.cfg" );
IResource main_cfg = container.findMember( "_main.cfg" ); //$NON-NLS-1$
if ( main_cfg != null ) {
// add main.cfg to tree
addNode( (IFile) main_cfg );
@ -107,12 +107,12 @@ public class DependencyTreeBuilder implements Serializable
*/
//TODO: check for including a specific config file?
if ( ( name.equals( "campaigns" ) ||
name.equals( "add-ons" ) ) &&
if ( ( name.equals( "campaigns" ) || //$NON-NLS-1$
name.equals( "add-ons" ) ) && //$NON-NLS-1$
// the call should contain just string values
macro.getExtraMacros( ).isEmpty( ) &&
macro.getParams( ).size( ) > 1 &&
macro.getParams( ).get( 0 ).equals( "/" ) )
macro.getParams( ).get( 0 ).equals( "/" ) ) //$NON-NLS-1$
{
// check if the macro includes directories local
// to this project
@ -121,7 +121,7 @@ public class DependencyTreeBuilder implements Serializable
if ( projectPath.contains( macro.getParams( ).get( 1 ) ) ) {
containersToAdd.add(
ListUtils.concatenateList(
macro.getParams( ).subList( 2, macro.getParams( ).size( ) ), "" ) );
macro.getParams( ).subList( 2, macro.getParams( ).size( ) ), "" ) ); //$NON-NLS-1$
}
}
}
@ -158,7 +158,7 @@ public class DependencyTreeBuilder implements Serializable
String fileName = resource.getName( );
// just config files.
if ( ! fileName.endsWith( ".cfg" ) ||
if ( ! fileName.endsWith( ".cfg" ) || //$NON-NLS-1$
! ( resource instanceof IFile ))
continue;
@ -168,25 +168,25 @@ public class DependencyTreeBuilder implements Serializable
}
}
System.out.println("tree:");
System.out.println("tree:"); //$NON-NLS-1$
if ( !tree_.isEmpty( ) ) {
ProjectDependencyNode node = tree_.get( "_ROOT_" ); // $NON-NLS-1$
ProjectDependencyNode node = tree_.get( "_ROOT_" ); // $NON-NLS-1$ //$NON-NLS-1$
do {
System.out.print( "> " );
System.out.print( "> " ); //$NON-NLS-1$
ProjectDependencyNode leaf = node;
do {
System.out.print( leaf + "; " );
System.out.print( leaf + "; " ); //$NON-NLS-1$
leaf = leaf.getNext( );
} while ( leaf != null );
node = node.getSon( );
System.out.print("\n");
System.out.print("\n"); //$NON-NLS-1$
}while ( node != null );
}
else {
System.out.println("Empty");
System.out.println("Empty"); //$NON-NLS-1$
}
}
@ -210,7 +210,7 @@ public class DependencyTreeBuilder implements Serializable
} else {
// no parent yet (== null)
// so we're making this the root node for this tree
tree_.put( "_ROOT_", newNode );
tree_.put( "_ROOT_", newNode ); //$NON-NLS-1$
}
parent_ = newNode;

View file

@ -168,6 +168,6 @@ public class ProjectDependencyNode implements Serializable
@Override
public String toString()
{
return ( file_ == null ? "" : fileName_ ) + "_" + index_;
return ( file_ == null ? "" : fileName_ ) + "_" + index_; //$NON-NLS-1$ //$NON-NLS-2$
}
}

View file

@ -390,17 +390,17 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
String name2 = o2.getName( );
// _initial.cfg is always the "lowest"
if ( name1.equals( "_initial.cfg" ) && !( name2.equals( "_initial.cfg" ) ) )
if ( name1.equals( "_initial.cfg" ) && !( name2.equals( "_initial.cfg" ) ) ) //$NON-NLS-1$ //$NON-NLS-2$
return -1;
if ( name2.equals( "_initial.cfg" ) && !( name1.equals( "_initial.cfg" ) ) )
if ( name2.equals( "_initial.cfg" ) && !( name1.equals( "_initial.cfg" ) ) ) //$NON-NLS-1$ //$NON-NLS-2$
return 1;
// _final.cfg is always the "highest"
if ( name1.equals( "_final.cfg" ) && !( name2.equals( "_final.cfg" ) ) )
if ( name1.equals( "_final.cfg" ) && !( name2.equals( "_final.cfg" ) ) ) //$NON-NLS-1$ //$NON-NLS-2$
return 1;
if ( name2.equals( "_final.cfg" ) && !( name1.equals( "_final.cfg" ) ) )
if ( name2.equals( "_final.cfg" ) && !( name1.equals( "_final.cfg" ) ) ) //$NON-NLS-1$ //$NON-NLS-2$
return -1;
return name1.compareTo( o2.getName( ) );

View file

@ -17,6 +17,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.swt.SWT;
import org.wesnoth.Constants;
import org.wesnoth.Logger;
import org.wesnoth.Messages;
import org.wesnoth.preferences.Preferences;
import org.wesnoth.projects.ProjectUtils;
import org.wesnoth.utils.GUIUtils;
@ -41,7 +42,7 @@ public class WesnothInstallsUtils
String[] tokens = str.split( ":" ); //$NON-NLS-1$
if ( tokens.length != 2 ) {
Logger.getInstance().logError( "invalid install [" + str + "] in installs list." ); //$NON-NLS-1$
Logger.getInstance().logError( "invalid install [" + str + "] in installs list." ); //$NON-NLS-1$ //$NON-NLS-2$
continue;
}
@ -127,10 +128,10 @@ public class WesnothInstallsUtils
return false;
if ( GUIUtils.showMessageBox(
"The existing set install for the project " +
Messages.WesnothInstallsUtils_1 +
resource.getProject( ).getName( ) +
" doesn't exist anymore or isn't fully configured. " +
"Do you want to try fallback to the default?",
Messages.WesnothInstallsUtils_2 +
Messages.WesnothInstallsUtils_3,
SWT.ICON_QUESTION | SWT.YES | SWT.NO) == SWT.NO )
return false; // no hope :(

View file

@ -246,6 +246,7 @@ ScenarioPage2_3=This is a multiplayer scenario
ScenarioPage2_4=Allow new game
SchemaFactory_1=this is a scenario tag
SchemaFactory_4=this is a campaign tag
SchemaParser_0=Tag shouldn't have been null\!
SchemaParser_1=schema not parsed since there is already in cache.
SchemaParser_18=Error. invalid primitive on line :
SchemaParser_2=parsing schema
@ -259,6 +260,22 @@ TemplateProvider_0=reading templates from:
TemplateProvider_15=error parsing 'structure template' (%s) on line %s
UploadAddon_0=Uploading addon...
UploadAddon_1=Upload addon result:
WesnothInstallsPage_0=Wesnoth Installs Preferences
WesnothInstallsPage_10=Set as default
WesnothInstallsPage_11=Install name:
WesnothInstallsPage_12=Default
WesnothInstallsPage_13=Wesnoth Version:
WesnothInstallsPage_19=Please enter a name for the install
WesnothInstallsPage_20=Please select a version before creating a new install.
WesnothInstallsPage_21=Yes
WesnothInstallsPage_5=Install Name
WesnothInstallsPage_6=Version
WesnothInstallsPage_7=Default?
WesnothInstallsPage_8=New
WesnothInstallsPage_9=Remove
WesnothInstallsUtils_1=The existing set install for the project
WesnothInstallsUtils_2=\ doesn't exist anymore or isn't fully configured.
WesnothInstallsUtils_3=Do you want to try fallback to the default?
WesnothPreferencesPage_0=Wesnoth User-Made-Content Plugin preferences
WesnothPreferencesPage_10=This directory should contain the data/add-ons/ directory, where user addons are stored.
WesnothPreferencesPage_11=WML* tools directory*:
@ -283,6 +300,9 @@ WesnothProjectBuilder_4=no preferences set (project builder)
WesnothProjectBuilder_5=Please set the wesnoth user dir before creating the content
WesnothProjectBuilder_6=Creating temporary directory...
WesnothProjectBuilder_8=Copying resources...
WesnothProjectPage_0=General
WesnothProjectPage_1=Wesnoth install:
WesnothProjectPage_2=The currently selected install does not exist. Please select another.
WesnothProjectReport_0=Please select a project first.
WesnothProjectReport_4=\ - Scenarios: %d \n - Maps: %d \n - Units: %d\n
WizardGeneratorPage404_1=content not found for tag '%s'

View file

@ -61,8 +61,8 @@ public class Preferences extends AbstractPreferenceInitializer
store.setDefault(Constants.P_ADV_NO_TERRAIN_GFX, true);
// installs
store.setDefault(Constants.P_INST_DEFAULT_INSTALL, ""); // $NON-NLS-1$
store.setDefault(Constants.P_INST_INSTALL_LIST, ""); // $NON-NLS-1$
store.setDefault(Constants.P_INST_DEFAULT_INSTALL, ""); //$NON-NLS-1$
store.setDefault(Constants.P_INST_INSTALL_LIST, ""); //$NON-NLS-1$
}
/**
@ -141,7 +141,7 @@ public class Preferences extends AbstractPreferenceInitializer
{
// no null allowed -> fallback to ""
if ( installName == null )
installName = "";
installName = ""; //$NON-NLS-1$
Paths paths = paths_.get( installName );
if ( paths == null ) {

View file

@ -82,7 +82,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
{
super(GRID);
setPreferenceStore(WesnothPlugin.getDefault().getPreferenceStore());
setTitle("Wesnoth Installs Preferences");
setTitle(Messages.WesnothInstallsPage_0);
wmlToolsList_ = new ArrayList<String>();
wmlToolsList_.add("wmllint"); //$NON-NLS-1$
@ -112,7 +112,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
}
};
wesnothExecutableField_ = new FileFieldEditor( "",
wesnothExecutableField_ = new FileFieldEditor( "", //$NON-NLS-1$
Messages.WesnothPreferencesPage_5, getFieldEditorParent());
wesnothExecutableField_.getTextControl(getFieldEditorParent()).
addFocusListener(new FocusListener() {
@ -137,17 +137,17 @@ public class WesnothInstallsPage extends AbstractPreferencePage
});
addField(wesnothExecutableField_, Messages.WesnothPreferencesPage_6);
wesnothWorkingDirField_ = new DirectoryFieldEditor( "",
wesnothWorkingDirField_ = new DirectoryFieldEditor( "", //$NON-NLS-1$
Messages.WesnothPreferencesPage_7, getFieldEditorParent());
wesnothWorkingDirField_.getTextControl(getFieldEditorParent()).
addModifyListener(listener);
addField(wesnothWorkingDirField_, Messages.WesnothPreferencesPage_8);
wesnothUserDirField_ = new DirectoryFieldEditor( "",
wesnothUserDirField_ = new DirectoryFieldEditor( "", //$NON-NLS-1$
Messages.WesnothPreferencesPage_9, getFieldEditorParent());
addField(wesnothUserDirField_, Messages.WesnothPreferencesPage_10);
wmlToolsField_ = new DirectoryFieldEditor( "",
wmlToolsField_ = new DirectoryFieldEditor( "", //$NON-NLS-1$
Messages.WesnothPreferencesPage_11, getFieldEditorParent());
addField(wmlToolsField_, Messages.WesnothPreferencesPage_12);
@ -184,15 +184,15 @@ public class WesnothInstallsPage extends AbstractPreferencePage
TableColumn tblclmnName = new TableColumn(installsTable_, SWT.NONE);
tblclmnName.setWidth(150);
tblclmnName.setText("Install Name");
tblclmnName.setText(Messages.WesnothInstallsPage_5);
TableColumn tblclmnWesnothVersion = new TableColumn(installsTable_, SWT.NONE);
tblclmnWesnothVersion.setWidth(70);
tblclmnWesnothVersion.setText("Version");
tblclmnWesnothVersion.setText(Messages.WesnothInstallsPage_6);
TableColumn tblclmnIsDefault = new TableColumn(installsTable_, SWT.NONE);
tblclmnIsDefault.setWidth(70);
tblclmnIsDefault.setText("Default?");
tblclmnIsDefault.setText(Messages.WesnothInstallsPage_7);
installsTableViewer_.setContentProvider(new ArrayContentProvider());
installsTableViewer_.setLabelProvider(new TableLabelProvider());
@ -214,7 +214,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
newInstall();
}
});
btnNew.setText("New");
btnNew.setText(Messages.WesnothInstallsPage_8);
Button btnRemove = new Button(composite, SWT.NONE);
btnRemove.addSelectionListener(new SelectionAdapter() {
@ -223,7 +223,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
removeInstall( getSelectedInstall( ) );
}
});
btnRemove.setText("Remove");
btnRemove.setText(Messages.WesnothInstallsPage_9);
Button btnSetAsDefault = new Button(composite, SWT.NONE);
btnSetAsDefault.addSelectionListener(new SelectionAdapter() {
@ -232,13 +232,13 @@ public class WesnothInstallsPage extends AbstractPreferencePage
setInstallAsDefault( getSelectedInstall( ) );
}
});
btnSetAsDefault.setText("Set as default");
btnSetAsDefault.setText(Messages.WesnothInstallsPage_10);
Label lblInstallName = new Label(parent, SWT.NONE);
lblInstallName.setText("Install name:");
lblInstallName.setText(Messages.WesnothInstallsPage_11);
txtInstallName_ = new Text(parent, SWT.SINGLE);
txtInstallName_.setText( "Default" );
txtInstallName_.setText( Messages.WesnothInstallsPage_12 );
txtInstallName_.setEditable( false );
txtInstallName_.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
txtInstallName_.addVerifyListener(new VerifyListener() {
@ -274,7 +274,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
});
Label lblVersion = new Label(parent, SWT.NONE);
lblVersion.setText("Wesnoth Version:");
lblVersion.setText(Messages.WesnothInstallsPage_13);
cmbVersion_ = new Combo(parent, SWT.READ_ONLY);
cmbVersion_.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
@ -352,7 +352,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
cmbVersion_.setText( install == null ? "" : install.getVersion( ) ); //$NON-NLS-1$
setFieldsPreferenceName(
install == null ? "" : Preferences.getInstallPrefix( install.getName( ) ),
install == null ? "" : Preferences.getInstallPrefix( install.getName( ) ), //$NON-NLS-1$
true );
}
@ -372,10 +372,10 @@ public class WesnothInstallsPage extends AbstractPreferencePage
wmlToolsField_.setPreferenceName( installPrefix + Constants.P_WESNOTH_WMLTOOLS_DIR );
if ( loadPreferences ) {
wesnothUserDirField_.setStringValue( "" );
wesnothWorkingDirField_.setStringValue( "" );
wesnothExecutableField_.setStringValue( "" );
wmlToolsField_.setStringValue( "" );
wesnothUserDirField_.setStringValue( "" ); //$NON-NLS-1$
wesnothWorkingDirField_.setStringValue( "" ); //$NON-NLS-1$
wesnothExecutableField_.setStringValue( "" ); //$NON-NLS-1$
wmlToolsField_.setStringValue( "" ); //$NON-NLS-1$
wesnothUserDirField_.load();
wesnothWorkingDirField_.load();
@ -544,7 +544,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
// if we haven't completed anything,
// we can skip the saving without alerting the user.
if ( !isFieldsEmpty )
GUIUtils.showErrorMessageBox( "Please enter a name for the install" );
GUIUtils.showErrorMessageBox( Messages.WesnothInstallsPage_19 );
// we consider successfully save if the fields are all
// empty
@ -553,7 +553,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
if ( cmbVersion_.getText().isEmpty() == true ) {
GUIUtils.showErrorMessageBox(
"Please select a version before creating a new install." );
Messages.WesnothInstallsPage_20 );
return false;
}
@ -634,9 +634,9 @@ public class WesnothInstallsPage extends AbstractPreferencePage
} else if ( columnIndex == 2 ) { // is Default ?
if ( install.getName( ).equals( Preferences.getDefaultInstallName( ) ) )
return "Yes";
return Messages.WesnothInstallsPage_21;
return "";
return ""; //$NON-NLS-1$
}
}
return ""; //$NON-NLS-1$

View file

@ -70,7 +70,7 @@ public class ProjectCache
"/.wesnoth"); //$NON-NLS-1$
definesFile_ = new File (PreprocessorUtils.getInstance().getDefinesLocation( project ));
treeCacheFile_ = new File ( WorkspaceUtils.getProjectTemporaryFolder( project ) + "/_TREE_CACHE_.bin" );
treeCacheFile_ = new File ( WorkspaceUtils.getProjectTemporaryFolder( project ) + "/_TREE_CACHE_.bin" ); //$NON-NLS-1$
ResourceUtils.createWesnothFile(wesnothFile_.getAbsolutePath(), false);
readProperties(true);
@ -95,7 +95,7 @@ public class ProjectCache
try
{
properties_.load( new InputStreamReader( new FileInputStream(
wesnothFile_.getAbsolutePath() ), "UTF-16" ) );
wesnothFile_.getAbsolutePath() ), "UTF-16" ) ); //$NON-NLS-1$
}
catch(ClassCastException ex)
{

View file

@ -14,6 +14,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.dialogs.PropertyPage;
import org.wesnoth.Messages;
import org.wesnoth.installs.WesnothInstall;
import org.wesnoth.installs.WesnothInstallsUtils;
import org.wesnoth.projects.ProjectCache;
@ -46,12 +47,12 @@ public class WesnothProjectPage extends PropertyPage
newComposite.setLayout(new FillLayout(SWT.VERTICAL));
Group grpGeneral = new Group(newComposite, SWT.NONE);
grpGeneral.setText("General");
grpGeneral.setText(Messages.WesnothProjectPage_0);
grpGeneral.setLayout(new GridLayout(2, false));
Label lblNewLabel = new Label(grpGeneral, SWT.NONE);
lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblNewLabel.setText("Wesnoth install:");
lblNewLabel.setText(Messages.WesnothProjectPage_1);
cmbInstall_ = new Combo(grpGeneral, SWT.READ_ONLY );
cmbInstall_.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
@ -76,7 +77,7 @@ public class WesnothProjectPage extends PropertyPage
// check if the current install name is existing
if ( !foundInstallInList ) {
setErrorMessage( "The currently selected install does not exist. Please select another." );
setErrorMessage( Messages.WesnothProjectPage_2 );
}
return newComposite;

View file

@ -40,7 +40,7 @@ public class SchemaParser
{
// null not allowed
if ( installName == null )
installName = "";
installName = ""; //$NON-NLS-1$
SchemaParser parser = parsers_.get( installName );
if (parser == null) {
@ -220,9 +220,13 @@ public class SchemaParser
value = new StringBuilder(value.substring(1, value.length() - 1));
}
currentTag.setDescription(new Tag(Messages.SchemaParser_25, '?'));
currentTag.getDescription().getKeyChildren().add(
new TagKey(tokens[0], '?', "", value.toString(), true)); //$NON-NLS-1$
if ( currentTag != null ) {
currentTag.setDescription(new Tag(Messages.SchemaParser_25, '?'));
currentTag.getDescription().getKeyChildren().add(
new TagKey(tokens[0], '?', "", value.toString(), true)); //$NON-NLS-1$
}else {
System.out.println( Messages.SchemaParser_0 );
}
}
else
{

View file

@ -72,7 +72,7 @@ public class GameUtils
String scenarioId = null;
campaignId = ProjectUtils.getCacheForProject(selectedResource.getProject()).
getConfig("_main.cfg").CampaignId;
getConfig("_main.cfg").CampaignId; //$NON-NLS-1$
if (scenario == true && selectedResource instanceof IFile)
scenarioId = ProjectUtils.getCacheForProject(selectedResource.getProject()).

View file

@ -23,7 +23,7 @@ public class ListUtils
{
if (list == null || list.isEmpty())
return ""; //$NON-NLS-1$
StringBuilder result = new StringBuilder(); //$NON-NLS-1$
StringBuilder result = new StringBuilder();
for (int i = 0; i < list.size() - 1; i++)
{
result.append(list.get(i) + separator);
@ -45,7 +45,7 @@ public class ListUtils
if (array == null || array.length == 0)
return ""; //$NON-NLS-1$
StringBuilder result = new StringBuilder(); //$NON-NLS-1$
StringBuilder result = new StringBuilder();
for (int i = 0; i < array.length - 1; i++)
{
result.append(array[i] + separator);