-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for localization (resource bundles)
- Loading branch information
Showing
9 changed files
with
115 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/net/sourceforge/openstego/resource/LabelBundle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
######## Resource bundle for labels to be displayed in OpenStego ######## | ||
|
||
# Master labels | ||
versionString = OpenStego v0.1.2 | ||
|
||
# Labels for exceptions | ||
err.fileLoadError = Error loading file\: {0} | ||
err.invalidHeader = Wrong Header\: Image does not contain embedded data | ||
err.config.maxBitsUsedPerChannel.notNumber = Invalid value for configuration item 'maxBitsUsedPerChannel'\: {0} | ||
err.config.maxBitsUsedPerChannel.notInRange = Configuration item 'maxBitsUsedPerChannel' must be between 1 and 8. Value given\: {0} | ||
err.config.useCompression.invalid = Invalid value for configuration item 'useCompression'\: {0} | ||
err.config.invalidKey = Invalid configuration item provided\: {0} | ||
err.image.indexed = Images with indexed color model (e.g. GIF) not supported | ||
err.image.arg.nullValue = Null value provided for image | ||
err.image.insufficientSize = Image size not enough to embed the data | ||
|
||
# Labels for command line interface | ||
cmd.usage = . Usage\: \n\ | ||
\ java -jar <path>/openstego.jar -embed [options] <data_file> <image_file>\n\ | ||
\ OR java -jar <path>/openstego.jar -extract <image_file>\n\ | ||
\n\ | ||
\ For '-embed' option, openstego will embed the data into the given image file\n\ | ||
\ and save the file as PNG after appending '_out' to the file name.\n\ | ||
\n\ | ||
\ [options] can be specified for '-embed' and should be of the format\n\ | ||
\ '--name\=value' pairs. Supported options are\:\n\ | ||
\n\ | ||
\ maxBitsUsedPerChannel - Max number of bits to use per color channel in\n\ | ||
\ the image for embedding data. This value can be\n\ | ||
\ increased at the expense of image quality, in\n\ | ||
\ case size of image is not able to accommodate\n\ | ||
\ the data (Default \= 3)\n\ | ||
\n\ | ||
\ useCompression - Flag to indicate whether compression should be\n\ | ||
\ used on the data or not (Default \= true)\n\ | ||
\n\ | ||
\ For '-extract' option, openstego will output the extracted data on the\n\ | ||
\ standard OUT stream, so make sure that output is redirected to required file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Utility to embed data into images | ||
* Author: Samir Vaidya (mailto:[email protected]) | ||
* Copyright (c) 2007 Samir Vaidya | ||
*/ | ||
|
||
package net.sourceforge.openstego.util; | ||
|
||
import java.util.Locale; | ||
import java.util.ResourceBundle; | ||
import java.text.MessageFormat; | ||
|
||
/** | ||
* Localized label handler for OpenStego | ||
*/ | ||
public class LabelUtil | ||
{ | ||
/** | ||
* Static variable to hold the labels loaded from resource file | ||
*/ | ||
private static ResourceBundle labels = null; | ||
|
||
static | ||
{ | ||
labels = ResourceBundle.getBundle("net.sourceforge.openstego.resource.LabelBundle", Locale.getDefault()); | ||
} | ||
|
||
/** | ||
* Method to get label value for the given label key | ||
* @param key Key for the label | ||
* @return Display value for the label | ||
*/ | ||
public static String getString(String key) | ||
{ | ||
return labels.getString(key); | ||
} | ||
|
||
/** | ||
* Method to get label value for the given label key (using optional parameters) | ||
* @param key Key for the label | ||
* @param parameters Parameters to pass for a parameterized label | ||
* @return Display value for the label | ||
*/ | ||
public static String getString(String key, Object[] parameters) | ||
{ | ||
return MessageFormat.format(labels.getString(key), parameters); | ||
} | ||
} |