Skip to content

Commit

Permalink
Enable translation to other languages
Browse files Browse the repository at this point in the history
Also fix bug with makerelease.bat; now it will copy dependency DLLs into the zipfiles
  • Loading branch information
molsonkiko committed Jul 3, 2024
1 parent 24d638b commit cc93a08
Show file tree
Hide file tree
Showing 22 changed files with 4,248 additions and 58 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- '*.PNG'
- 'makerelease.bat'
- 'testfiles/**'
- 'translation/**'

jobs:
build:
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added

1. Make it much easier to [include third-party dependencies](/docs/README.md#loading-third-party-dependencies) in your plugin.
2. Made it so all forms subclass a base class, making it easier to implement recommended methods.
2. Added the ability to [translate the plugin into other languages](/README.md#translating-your-plugin-to-another-language).
3. Made it so all forms subclass a base class, making it easier to implement recommended methods.

### Fixed

Expand All @@ -36,6 +37,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3. Fix error due to assuming that "." (the current directory according to the filesystem) will always point to the path to the Notepad++ executable; this is *almost always true*, but can be broken due to at least one known weird interaction (the one molsonkiko is familiar with concerns the `New script` functionality of the PythonScript plugin).
4. Fix bug where, if a setting in the config file had an invalid value (for example, a numeric setting having a value of `blah`), there might be an uncaught exception that would cause Notepad++ to crash. This bug appears to be most likely to occur when the localization is *not* set to `en-us`.
5. Fix bug (related to fixed bug 4 above) where *all settings with non-integer floating-point values* would cause Notepad++ to crash on start-up if the localization used `,` as the decimal separator.
6. Fix bug with [makerelease.bat](/makerelease.bat) where it did not properly copy the dependency DLLs into the zip files.

## [0.0.3] - 2024-02-26

Expand Down
1 change: 1 addition & 0 deletions NppCSharpPluginPack/Forms/AboutForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public AboutForm()
{
InitializeComponent();
NppFormHelper.RegisterFormIfModeless(this, true);
Translator.TranslateForm(this);
FormStyle.ApplyStyle(this, Main.settings.use_npp_styling);
ThanksWowLinkLabel.LinkColor = ThanksWowLinkLabel.ForeColor; // hidden!
Title.Text = Title.Text.Replace("X.Y.Z.A", Npp.AssemblyVersionString());
Expand Down
8 changes: 5 additions & 3 deletions NppCSharpPluginPack/Forms/DarkModeTestForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions NppCSharpPluginPack/Forms/DarkModeTestForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,11 @@ private void ShowPopupDialogButton_Click(object sender, System.EventArgs e)
using (var popupDialog = new PopupDialog())
popupDialog.ShowDialog();
}

private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
if (!Translator.HasTranslations) // the translator takes care of the CheckedChanged event if it is active
checkBox1.Text = checkBox1.Checked ? "checkBox1 is checked" : "checkBox1 is unchecked";
}
}
}
52 changes: 26 additions & 26 deletions NppCSharpPluginPack/Forms/DarkModeTestForm.resx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down Expand Up @@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADw
CgAAAk1TRnQBSQFMAgEBAwEAASgBAAEoAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CgAAAk1TRnQBSQFMAgEBAwEAATABAAEwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down
1 change: 1 addition & 0 deletions NppCSharpPluginPack/Forms/FormBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ private void FormBase_VisibleChanged(object sender, EventArgs e)
// because it must be called *after* the subclass constructor adds all child controls
// and the base constructor must be called first (that's just how C# works)
AddKeyUpDownPressHandlers(this);
Translator.TranslateForm(this);
FormStyle.ApplyStyle(this, Main.settings.use_npp_styling);
}

Expand Down
Loading

0 comments on commit cc93a08

Please sign in to comment.