Skip to content

Commit cc93a08

Browse files
committed
Enable translation to other languages
Also fix bug with makerelease.bat; now it will copy dependency DLLs into the zipfiles
1 parent 24d638b commit cc93a08

22 files changed

+4248
-58
lines changed

.github/workflows/CI_build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- '*.PNG'
1111
- 'makerelease.bat'
1212
- 'testfiles/**'
13+
- 'translation/**'
1314

1415
jobs:
1516
build:

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2727
### Added
2828

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

3233
### Fixed
3334

@@ -36,6 +37,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3637
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).
3738
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`.
3839
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.
40+
6. Fix bug with [makerelease.bat](/makerelease.bat) where it did not properly copy the dependency DLLs into the zip files.
3941

4042
## [0.0.3] - 2024-02-26
4143

NppCSharpPluginPack/Forms/AboutForm.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public AboutForm()
1010
{
1111
InitializeComponent();
1212
NppFormHelper.RegisterFormIfModeless(this, true);
13+
Translator.TranslateForm(this);
1314
FormStyle.ApplyStyle(this, Main.settings.use_npp_styling);
1415
ThanksWowLinkLabel.LinkColor = ThanksWowLinkLabel.ForeColor; // hidden!
1516
Title.Text = Title.Text.Replace("X.Y.Z.A", Npp.AssemblyVersionString());

NppCSharpPluginPack/Forms/DarkModeTestForm.Designer.cs

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

NppCSharpPluginPack/Forms/DarkModeTestForm.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,11 @@ private void ShowPopupDialogButton_Click(object sender, System.EventArgs e)
4444
using (var popupDialog = new PopupDialog())
4545
popupDialog.ShowDialog();
4646
}
47+
48+
private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
49+
{
50+
if (!Translator.HasTranslations) // the translator takes care of the CheckedChanged event if it is active
51+
checkBox1.Text = checkBox1.Checked ? "checkBox1 is checked" : "checkBox1 is unchecked";
52+
}
4753
}
4854
}

NppCSharpPluginPack/Forms/DarkModeTestForm.resx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<root>
3-
<!--
3+
<!--
44
Microsoft ResX Schema
5-
5+
66
Version 2.0
7-
8-
The primary goals of this format is to allow a simple XML format
9-
that is mostly human readable. The generation and parsing of the
10-
various data types are done through the TypeConverter classes
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
1111
associated with the data types.
12-
12+
1313
Example:
14-
14+
1515
... ado.net/XML headers & schema ...
1616
<resheader name="resmimetype">text/microsoft-resx</resheader>
1717
<resheader name="version">2.0</resheader>
@@ -26,36 +26,36 @@
2626
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
2727
<comment>This is a comment</comment>
2828
</data>
29-
30-
There are any number of "resheader" rows that contain simple
29+
30+
There are any number of "resheader" rows that contain simple
3131
name/value pairs.
32-
33-
Each data row contains a name, and value. The row also contains a
34-
type or mimetype. Type corresponds to a .NET class that support
35-
text/value conversion through the TypeConverter architecture.
36-
Classes that don't support this are serialized and stored with the
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
3737
mimetype set.
38-
39-
The mimetype is used for serialized objects, and tells the
40-
ResXResourceReader how to depersist the object. This is currently not
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
4141
extensible. For a given mimetype the value must be set accordingly:
42-
43-
Note - application/x-microsoft.net.object.binary.base64 is the format
44-
that the ResXResourceWriter will generate, however the reader can
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
4545
read any of the formats listed below.
46-
46+
4747
mimetype: application/x-microsoft.net.object.binary.base64
48-
value : The object must be serialized with
48+
value : The object must be serialized with
4949
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
5050
: and then encoded with base64 encoding.
5151
5252
mimetype: application/x-microsoft.net.object.soap.base64
53-
value : The object must be serialized with
53+
value : The object must be serialized with
5454
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
5555
: and then encoded with base64 encoding.
5656
5757
mimetype: application/x-microsoft.net.object.bytearray.base64
58-
value : The object must be serialized into a byte array
58+
value : The object must be serialized into a byte array
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->
@@ -125,7 +125,7 @@
125125
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
126126
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
127127
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADw
128-
CgAAAk1TRnQBSQFMAgEBAwEAASgBAAEoAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
128+
CgAAAk1TRnQBSQFMAgEBAwEAATABAAEwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
129129
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
130130
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
131131
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

NppCSharpPluginPack/Forms/FormBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ private void FormBase_VisibleChanged(object sender, EventArgs e)
7070
// because it must be called *after* the subclass constructor adds all child controls
7171
// and the base constructor must be called first (that's just how C# works)
7272
AddKeyUpDownPressHandlers(this);
73+
Translator.TranslateForm(this);
7374
FormStyle.ApplyStyle(this, Main.settings.use_npp_styling);
7475
}
7576

0 commit comments

Comments
 (0)