Skip to content

Commit

Permalink
Show AssemblyInfromationalVersion, if available;
Browse files Browse the repository at this point in the history
fix the AGPL source link title localization is missing
  • Loading branch information
roman-yagodin committed Sep 16, 2020
1 parent feb45bc commit 856c685
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 7 deletions.
6 changes: 3 additions & 3 deletions R7.News/Controls/AgplSignature.ascx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%@ Control Language="C#" AutoEventWireup="false" Inherits="R7.News.Controls.AgplSignature" CodeBehind="AgplSignature.ascx.cs" %>
<div class="news-agpl-footer">
<% if (ShowRule) { %><hr class="my-0 ml-0" /><% } %>
<a href="https://github.com/roman-yagodin/R7.News" rel="nofollow" target="_blank" class="text-muted" title="<%= LocalizeString ("SourceLink.Title") %>">
<%= string.Format ("{0} v{1}", AppName, AppVersion.ToString (3)) %>
<a href="https://github.com/roman-yagodin/R7.News" rel="nofollow" target="_blank" class="text-muted" title='<%= LocalizeString ("SourceLink_Title.Text") %>'>
<%= string.Format ("{0} v{1}", AppName, GetVersionString ()) %>
</a>
</div>
</div>
15 changes: 11 additions & 4 deletions R7.News/Controls/AgplSignature.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,19 @@ protected string LocalizeString (string key)
return Localization.GetString (key, LocalResourceFile);
}

protected string AppName {
get { return Assembly.GetExecutingAssembly ().GetName ().Name; }
protected string GetVersionString ()
{
var assembly = Assembly.GetExecutingAssembly ();
var assemblyInformationalVersion = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute> ();
if (assemblyInformationalVersion != null) {
return assemblyInformationalVersion.InformationalVersion;
}

return assembly.GetName ().Version.ToString (3);
}

protected Version AppVersion {
get { return Assembly.GetExecutingAssembly ().GetName ().Version; }
protected string AppName {
get { return Assembly.GetExecutingAssembly ().GetName ().Name; }
}
}
}
18 changes: 18 additions & 0 deletions R7.News/Controls/App_LocalResources/AgplSignature.ascx.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="SourceLink_Title.Text" xml:space="preserve">
<value>The source code (AGPL-licensed)</value>
</data>
</root>
18 changes: 18 additions & 0 deletions R7.News/Controls/App_LocalResources/AgplSignature.ascx.ru-RU.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="SourceLink_Title.Text" xml:space="preserve">
<value>Исходный код (под лицензией AGPL)</value>
</data>
</root>
2 changes: 2 additions & 0 deletions R7.News/R7.News.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SqlDataProvider\01.00.00.SqlDataProvider" />
<None Include="Controls\App_LocalResources\AgplSignature.ascx.resx" />
<None Include="Controls\App_LocalResources\AgplSignature.ascx.ru-RU.resx" />
<None Include="Controls\App_LocalResources\ActionButtons.ascx.resx" />
<None Include="Controls\App_LocalResources\ActionButtons.ascx.ru-RU.resx" />
<None Include="SqlDataProvider\01.03.00.SqlDataProvider" />
Expand Down

1 comment on commit 856c685

@roman-yagodin
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.