-
-
Notifications
You must be signed in to change notification settings - Fork 3
added support for column name localization #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<root> | ||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
<xsd:element name="root" msdata:IsDataSet="true"> | ||
|
||
</xsd:element> | ||
</xsd:schema> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>1.3</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<data name="LocalizedColumn" xml:space="preserve"> | ||
<value>Lokalizovaný sloupec</value> | ||
</data> | ||
</root> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<root> | ||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
<xsd:element name="root" msdata:IsDataSet="true"> | ||
|
||
</xsd:element> | ||
</xsd:schema> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>1.3</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<data name="LocalizedColumn" xml:space="preserve"> | ||
<value>LocalizedColumn</value> | ||
</data> | ||
</root> |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,6 +2,7 @@ | |||||||||||||||||||||||||||||||||||
using System.Collections.Generic; | ||||||||||||||||||||||||||||||||||||
using System.ComponentModel; | ||||||||||||||||||||||||||||||||||||
using System.ComponentModel.DataAnnotations; | ||||||||||||||||||||||||||||||||||||
using System.Resources; | ||||||||||||||||||||||||||||||||||||
using System.Text.RegularExpressions; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
namespace ICG.NetCore.Utilities.Spreadsheet; | ||||||||||||||||||||||||||||||||||||
|
@@ -50,6 +51,11 @@ public static IList<PropDetail> GetProps(Type t) | |||||||||||||||||||||||||||||||||||
format = (sca.Format ?? format).ToLowerInvariant(); | ||||||||||||||||||||||||||||||||||||
propName = sca.DisplayName ?? propName; | ||||||||||||||||||||||||||||||||||||
width = sca.Width; | ||||||||||||||||||||||||||||||||||||
if (sca.ResourceFileType != null && string.IsNullOrWhiteSpace(sca.ResourceKey) == false) | ||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||
ResourceManager rm = new(sca.ResourceFileType); | ||||||||||||||||||||||||||||||||||||
propName = rm.GetString(sca.ResourceKey) ?? propName; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
Comment on lines
+54
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The implementation for retrieving localized property names using + try
+ {
+ propName = rm.GetString(sca.ResourceKey) ?? propName;
+ }
+ catch (Exception ex)
+ {
+ // Handle exception (e.g., log it)
+ } Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||
formula = sca.Formula; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
else if (attr is DisplayAttribute display) | ||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test method
CreateSheet_With_Localized_ColumnName
is well-implemented for generating a spreadsheet with a localized column name. Consider adding a verification step to ensure that the column names are correctly localized in the resulting file.Would you like assistance in implementing this verification step?