Test with the ImgurPlugin and designer language support, the form needs to extend a simple class which extends GreenshotForm and implements the language pattern getter. Some day we can change this to be simpler when there is only one global Language object...

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1774 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-04-12 14:44:21 +00:00
commit d1b5232898
9 changed files with 190 additions and 87 deletions

View file

@ -74,7 +74,8 @@ namespace GreenshotPlugin.Core {
private static string PAF_LANGUAGE_PATH = Path.Combine(APPLICATION_PATH, @"App\Greenshot\Languages");
private const string HELP_FILENAME_PATTERN = @"help-*.html";
private const string LANGUAGE_GROUPS_KEY = @"SYSTEM\CurrentControlSet\Control\Nls\Language Groups";
private static string globalLanguage = null;
private static string globalLanguage = DEFAULT_LANGUAGE;
private string additionalPath = null; // Set if the designer is used
private Dictionary<string, string> strings = new Dictionary<string, string>();
private List<LanguageConfiguration> languages = new List<LanguageConfiguration>();
@ -106,7 +107,11 @@ namespace GreenshotPlugin.Core {
instances.Add(this);
}
public LanguageContainer(string filePattern) : this() {
public LanguageContainer(string filePattern) : this(filePattern, null) {
}
public LanguageContainer(string filePattern, string additionalPath) {
this.additionalPath = additionalPath;
LanguageFilePattern = filePattern;
Load();
SetInstanceLanguage(globalLanguage);
@ -171,7 +176,7 @@ namespace GreenshotPlugin.Core {
Dictionary<string, LanguageConfiguration> identifiedLanguages = new Dictionary<string, LanguageConfiguration>();
if (languages == null || languages.Count == 0) {
throw new FileNotFoundException("No language files found!");
throw new FileNotFoundException(string.Format("No language files for {0} found!", wantedIETF));
}
// Find selected languages in available languages
@ -265,6 +270,9 @@ namespace GreenshotPlugin.Core {
} else {
languageDirectories.Add(APPLICATIONDATA_LANGUAGE_PATH);
}
if (additionalPath != null) {
languageDirectories.Add(additionalPath);
}
languageDirectories.Add(STARTUP_LANGUAGE_PATH);
foreach(string path in languageDirectories) {
if (!Directory.Exists(path)) {