1
0

Added base site localization

This commit is contained in:
Michael Gordeev
2020-04-05 16:14:54 +03:00
parent 304daf138d
commit 5bd29951a4
22 changed files with 710 additions and 88 deletions
@@ -1,7 +1,10 @@
<!DOCTYPE html> @using Microsoft.AspNetCore.Mvc.Localization
@inject IHtmlLocalizer<SharedResources> SharedLocalizer
<!DOCTYPE html>
<html> <html>
<head> <head>
<title>@ViewData["Title"] - Admin pangel - XFox111.NET</title> <title>@ViewData["Title"] - Admin panel - XFox111.NET</title>
<link rel="shortcut icon" href="~/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="~/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="~/css/Style.css" /> <link rel="stylesheet" type="text/css" href="~/css/Style.css" />
@@ -12,7 +15,7 @@
<script type="text/javascript"> <script type="text/javascript">
function ToggleMenu() function ToggleMenu()
{ {
var menu = document.getElementById("main-menu"); var menu = document.querySelector("nav menu");
if (menu.style.display == "none") if (menu.style.display == "none")
menu.style.display = "initial"; menu.style.display = "initial";
@@ -23,24 +26,6 @@
@RenderSection("Imports", false) @RenderSection("Imports", false)
@{
if (IsSectionDefined("OpenGraph"))
RenderSection("OpenGraph");
else
{
<meta name="author" content="Michael 'XFox' Gordeev" />
<meta name="description" content="Hi, my name is Michael. I'm C# Developer and this is my personal website. Here you can find info about me, my projects and more. Check it out!" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="XFox111.NET" />
<meta property="og:url" content="//XFox111.NET/" />
<meta property="og:locale" content="en_US" />
<meta property="og:image" content="/images/me.png" />
<meta property="og:description" content="Hi, my name is Michael. I'm C# Developer and this is my personal website. Here you can find info about me, my projects and more. Check it out!" />
<meta property="og:title" content="Michael 'XFox' Gordeev - Personal website" />
}
}
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head> </head>
@@ -48,22 +33,17 @@
<nav> <nav>
<a asp-controller="Home" asp-action="Index" asp-area="">XFox111.NET</a> <a asp-controller="Home" asp-action="Index" asp-area="">XFox111.NET</a>
<menu type="toolbar" id="main-menu" style="display:none"> <menu type="toolbar" style="display:none">
<li><a asp-area="" asp-controller="Home" asp-action="Index">AboutMe();</a></li> <partial name="~/Views/Shared/TopBarMenu.cshtml" />
<li><a href="//xfox111.blogspot.com/" target="_blank">MyBlog();</a></li>
<li><a asp-area="" asp-controller="Resume" asp-action="Index">Resume();</a></li>
<li><a asp-area="" asp-controller="Projects" asp-action="Index">Projects();</a></li>
<li><a asp-area="" asp-controller="Gallery" asp-action="Index">Arts();</a></li>
<li><a asp-area="" asp-controller="Contacts" asp-action="Index">Contacts();</a></li>
</menu> </menu>
<div> <div>
<a asp-controller="Home" asp-action="SwitchLanguage" lang="ru">РУС &#xE12B;</a> <a asp-area="" asp-controller="Home" asp-action="SwitchLanguage" lang="@SharedLocalizer["ru"]">@SharedLocalizer["РУС"] &#xE12B;</a>
<a id="menu-toggle" onclick="ToggleMenu();">&#xE700;</a> <a id="menu-toggle" onclick="ToggleMenu();">&#xE700;</a>
</div> </div>
</nav> </nav>
<main onclick="document.querySelector('#main-menu').style.display = 'none'"> <main onclick="document.querySelector('nav menu').style.display = 'none'">
@RenderBody() @RenderBody()
</main> </main>
@@ -1,6 +1,10 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Mvc;
using MyWebsite.Models.Databases; using MyWebsite.Models.Databases;
using MyWebsite.ViewModels; using MyWebsite.ViewModels;
using System;
using System.Globalization;
namespace MyWebsite.Controllers namespace MyWebsite.Controllers
{ {
@@ -32,5 +36,19 @@ namespace MyWebsite.Controllers
[Route("GetError")] [Route("GetError")]
public IActionResult GetError(int errorCode = 404) => public IActionResult GetError(int errorCode = 404) =>
StatusCode(errorCode); StatusCode(errorCode);
[Route("SwitchLanguage")]
public IActionResult SwitchLanguage()
{
Response.Cookies.Append(
CookieRequestCultureProvider.DefaultCookieName,
CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(
CultureInfo.CurrentCulture.TwoLetterISOLanguageName.ToUpperInvariant() == "RU" ?
"en" : "ru"
)),
new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1) });
return Redirect(Request.Headers["Referer"]);
}
} }
} }
@@ -0,0 +1,7 @@
namespace MyWebsite
{
/// <summary>
/// Dummy-class for shared localization resources
/// </summary>
public class SharedResources { }
}
+2 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<AssemblyName>XFox111dotNET</AssemblyName> <AssemblyName>MyWebsite</AssemblyName>
<Authors>Michael "XFox" Gordeev</Authors> <Authors>Michael "XFox" Gordeev</Authors>
<Company>FoxDev Studio</Company> <Company>FoxDev Studio</Company>
<Product>XFox111.NET</Product> <Product>XFox111.NET</Product>
@@ -24,6 +24,7 @@
<PackageReference Include="Select.HtmlToPdf.NetCore" Version="19.2.0" /> <PackageReference Include="Select.HtmlToPdf.NetCore" Version="19.2.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Resources\Areas\" />
<Folder Include="wwwroot\images\Gallery\Cache\" /> <Folder Include="wwwroot\images\Gallery\Cache\" />
</ItemGroup> </ItemGroup>
</Project> </Project>
@@ -0,0 +1,195 @@
<?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
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<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
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
mimetype set.
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
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
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
: 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
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<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="AboutMe" xml:space="preserve">
<value>ОбоМне</value>
</data>
<data name="All links are clickable" xml:space="preserve">
<value>Все ссылки кликабельны</value>
</data>
<data name="Arts" xml:space="preserve">
<value>Галерея</value>
</data>
<data name="Back to main menu" xml:space="preserve">
<value>Назад в главное меню</value>
</data>
<data name="Blog" xml:space="preserve">
<value>Блог</value>
</data>
<data name="Contact information" xml:space="preserve">
<value>Контактная информация</value>
</data>
<data name="ContactMe" xml:space="preserve">
<value>СвязатьсяСоМной</value>
</data>
<data name="Contacts" xml:space="preserve">
<value>Контакты</value>
</data>
<data name="Copyright" xml:space="preserve">
<value />
</data>
<data name="en" xml:space="preserve">
<value>ru</value>
</data>
<data name="Here is presented the most of projects I worked on" xml:space="preserve">
<value>Здесь собрано большинство проектов над которыми я когда-либо работал</value>
</data>
<data name="Hi, my name is Michael. I'm C# Developer and this is my personal website. Here you can find info about me, my projects and more. Check it out!" xml:space="preserve">
<value>Привет! Меня зовут Михаил и я C# разработчик. Это мой личный веб-сайт. Здесь вы можете найти информацию обо мне и моих проектах</value>
</data>
<data name="InterestedInMe" xml:space="preserve">
<value>Заинтересовались</value>
</data>
<data name="Michael &quot;XFox&quot; Gordeev" xml:space="preserve">
<value>Михаил "XFox" Гордеев</value>
</data>
<data name="Michael (Mikhail) Gordeev - Resume" xml:space="preserve">
<value>Михаил Гордеев - Резюме</value>
</data>
<data name="My artworks" xml:space="preserve">
<value>Мои рисунки</value>
</data>
<data name="My projects" xml:space="preserve">
<value>Мои проекты</value>
</data>
<data name="MyResume" xml:space="preserve">
<value>Резюме</value>
</data>
<data name="No content available" xml:space="preserve">
<value>Нет доступного контента</value>
</data>
<data name="Personal website" xml:space="preserve">
<value>Личный веб-сайт</value>
</data>
<data name="Projects" xml:space="preserve">
<value>Проекты</value>
</data>
<data name="ru" xml:space="preserve">
<value>en</value>
</data>
<data name="socialNetworks" xml:space="preserve">
<value>соцСети</value>
</data>
<data name="You" xml:space="preserve">
<value>Вы</value>
</data>
<data name="РУС" xml:space="preserve">
<value>ENG</value>
</data>
</root>
@@ -0,0 +1,132 @@
<?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
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<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
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
mimetype set.
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
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
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
: 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
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<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="All artworks" xml:space="preserve">
<value>Все рисунки</value>
</data>
<data name="Creation date" xml:space="preserve">
<value>Дата создания</value>
</data>
<data name="Next" xml:space="preserve">
<value>Следующий</value>
</data>
<data name="Previous" xml:space="preserve">
<value>Предыдущий</value>
</data>
</root>
@@ -0,0 +1,132 @@
<?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
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<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
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
mimetype set.
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
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
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
: 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
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<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="Download CV" xml:space="preserve">
<value>Скачать резюме</value>
</data>
<data name="Last update" xml:space="preserve">
<value>Последнее обновление</value>
</data>
<data name="My resume" xml:space="preserve">
<value>Мое резюме</value>
</data>
<data name="Print CV" xml:space="preserve">
<value>Распечатать резюме</value>
</data>
</root>
@@ -0,0 +1,135 @@
<?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
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<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
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
mimetype set.
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
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
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
: 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
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<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="But you still can lurk around and check other pages. I'm pretty sure they should be fine." xml:space="preserve">
<value>Но вы все еще можете побродить по остальным страницам. Я почти уверен, что они должны быть в порядке.</value>
</data>
<data name="Cheers" xml:space="preserve">
<value>Удачи</value>
</data>
<data name="Hello, World!" xml:space="preserve">
<value>Привет, мир!</value>
</data>
<data name="Hi guys! This is my website. And this is its home page. Usually, homepages should look as much glorious and cool as they can. But for some inspirational reasons I've done everything except homepage." xml:space="preserve">
<value>Всем привет! Это мой мой веб-сайт, и это его главная страница. Обычно такие страницы должны выглядеть максимально круто и эпично, но из-за проблем с вдохновением, я сделал все, кроме нее.</value>
</data>
<data name="Home Page" xml:space="preserve">
<value>Домашняя страница</value>
</data>
</root>
+24 -1
View File
@@ -7,6 +7,9 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using MyWebsite.Models.Databases; using MyWebsite.Models.Databases;
using Microsoft.AspNetCore.Mvc.Razor;
using System.Globalization;
using Microsoft.AspNetCore.Localization;
namespace MyWebsite namespace MyWebsite
{ {
@@ -39,7 +42,14 @@ namespace MyWebsite
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options =>
options.LoginPath = new PathString("/Admin/Login")); options.LoginPath = new PathString("/Admin/Login"));
services.AddControllersWithViews(); services.AddLocalization(options => options.ResourcesPath = "Resources");
services.AddControllersWithViews()
.AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix)
.AddDataAnnotationsLocalization(options => {
options.DataAnnotationLocalizerProvider = (type, factory) =>
factory.Create(typeof(SharedResources));
});
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -55,6 +65,19 @@ namespace MyWebsite
} }
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseStatusCodePagesWithReExecute("/Error"); app.UseStatusCodePagesWithReExecute("/Error");
CultureInfo[] supportedCultures = new[]
{
new CultureInfo("en"),
new CultureInfo("ru"),
};
app.UseRequestLocalization(new RequestLocalizationOptions
{
DefaultRequestCulture = new RequestCulture("en"),
SupportedCultures = supportedCultures,
SupportedUICultures = supportedCultures
});
app.UseStaticFiles(); app.UseStaticFiles();
app.UseRouting(); app.UseRouting();
@@ -7,14 +7,14 @@
@if (Model.Previous != null) @if (Model.Previous != null)
{ {
@:&#xE760; @:&#xE760;
<a asp-action="Details" asp-route-id="@Model.Previous">Previous</a> <a asp-action="Details" asp-route-id="@Model.Previous">@Localizer["Previous"]</a>
@:| @:|
} }
&#xE8B9; <a asp-action="Index" asp-controller="Gallery">All artworks</a> &#xE8B9; <a asp-action="Index" asp-controller="Gallery">@Localizer["All artworks"]</a>
@if (Model.Next != null) @if (Model.Next != null)
{ {
@:| &#xE761; @:| &#xE761;
<a asp-action="Details" asp-route-id="@Model.Next">Next</a> <a asp-action="Details" asp-route-id="@Model.Next">@Localizer["Next"]</a>
} }
</header> </header>
@@ -23,7 +23,7 @@
<div> <div>
<h1>@Model.Current?.Title</h1> <h1>@Model.Current?.Title</h1>
<span>Creation date: @Model.Current?.CreationDate.ToShortDateString()</span> <span>@Localizer["Creation date"]: @Model.Current?.CreationDate.ToShortDateString()</span>
<p> <p>
@Html.Raw(Model.Current?.Description) @Html.Raw(Model.Current?.Description)
</p> </p>
@@ -1,10 +1,10 @@
@model ArtworkViewModel @model ArtworkViewModel
@{ @{
ViewData["Title"] = "My artworks"; ViewData["Title"] = SharedLocalizer["My artworks"];
} }
<header> <header>
<h1>My arts</h1> <h1>@SharedLocalizer["My artworks"]</h1>
</header> </header>
<article class="gallery"> <article class="gallery">
@@ -15,7 +15,7 @@
} }
else else
{ {
<p class="comment">// No content available</p> <p class="comment">// @SharedLocalizer["No content available"]</p>
} }
</article> </article>
@@ -1,14 +1,14 @@
@model ResumeViewModel @model ResumeViewModel
@{ @{
ViewData["Title"] = "My resume"; ViewData["Title"] = Localizer["My resume"];
} }
<header> <header>
<h1>My resume</h1> <h1>@Localizer["My resume"]</h1>
<p>Last update: @Model.Resume.LastUpdate</p> <p>@Localizer["Last update"]: @Model.Resume.LastUpdate</p>
<a class="comment" asp-action="Download">// Download CV (.pdf) &#xE118;</a><br /> <a class="comment" asp-action="Download">// @Localizer["Download CV"] (.pdf) &#xE118;</a><br />
<a class="comment" asp-action="Print">// Print CV &#xE749;</a> <a class="comment" asp-action="Print">// @Localizer["Print CV"] &#xE749;</a>
</header> </header>
<article> <article>
@@ -6,7 +6,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Michael (Mikhail) Gordeev - Resume</title> <title>@SharedLocalizer["Michael (Mikhail) Gordeev - Resume"]</title>
<link rel="shortcut icon" href="~/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="~/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="~/css/Style.css" /> <link rel="stylesheet" type="text/css" href="~/css/Style.css" />
@@ -1,10 +1,10 @@
@model ViewModelBase @model ViewModelBase
@{ @{
ViewData["Title"] = "Contact info"; ViewData["Title"] = SharedLocalizer["Contact information"];
} }
<header> <header>
<h1>Contact information</h1> <h1>@SharedLocalizer["Contact information"]</h1>
</header> </header>
<article> <article>
@@ -5,20 +5,20 @@
} }
<footer> <footer>
<var>if</var> (<var class="class">You</var>.InsterestedInMe)<br /> <var>if</var> (<var class="class">@SharedLocalizer["You"]</var>.@SharedLocalizer["InterestedInMe"])<br />
<div> <div>
<var class="method">ContactMe</var>();<br /> <var class="method">@SharedLocalizer["ContactMe"]</var>();<br />
</div> </div>
<br /> <br />
<a class="comment">// All links are clickable</a><br /> <a class="comment">// @SharedLocalizer["All links are clickable"] </a><br />
<var>public void</var> <var class="method">ConatactMe</var>()<br /> <var>public void</var> <var class="method">@SharedLocalizer["ContactMe"]</var>()<br />
{<br /> {<br />
<div> <div>
@if (email != null) @if (email != null)
{ {
<span><var>string</var> email = <a href="@email.Url">@email.Username</a>;<br /></span> <span><var>string</var> email = <a href="@email.Url">@email.Username</a>;<br /></span>
} }
<var class="class">Link</var>[] socialNetworks = <var>new</var> <var class="class">Link</var>[]<br /> <var class="class">Link</var>[] @SharedLocalizer["socialNetworks"] = <var>new</var> <var class="class">Link</var>[]<br />
{<br /> {<br />
<div> <div>
@foreach (LinkModel link in links) @foreach (LinkModel link in links)
@@ -30,7 +30,7 @@
</div> </div>
}<br /> }<br />
<br /> <br />
<a class="comment">// Copyright &copy;@(DateTime.Today.Year) Michael "XFox" Gordeev</a> <a class="comment">// @SharedLocalizer["Copyright"] &copy;@(DateTime.Today.Year) @SharedLocalizer["Michael \"XFox\" Gordeev"]</a>
</footer> </footer>
<link rel="stylesheet" type="text/css" href="~/css/ContactsBlock.css" /> <link rel="stylesheet" type="text/css" href="~/css/ContactsBlock.css" />
@@ -1,25 +1,25 @@
@{ @{
ViewData["Title"] = "Home Page"; ViewData["Title"] = Localizer["Home Page"];
} }
<header> <header>
<h1>Hello, World!</h1> <h1>@Localizer["Hello, World!"]</h1>
</header> </header>
<article> <article>
<p> <p>
Hi guys! This is my website. And this is its home page. Usually, homepages should look as much glorious and cool as they can. But for some inspirational reasons I've done everything except homepage. @Localizer["Hi guys! This is my website. And this is its home page. Usually, homepages should look as much glorious and cool as they can. But for some inspirational reasons I've done everything except homepage."]
</p> </p>
<p> <p hidden>
Well, maybe not everything... But the most of it. If I could I would leave it offline for a few more <s>years</s> <s>month</s> time. But I need it online now, so here we go. <br /> Well, maybe not everything... But the most of it. If I could I would leave it offline for a few more <s>years</s> <s>month</s> time. But I need it online now, so here we go. <br />
Lets consider it as 0.1.2020.03.08.666 prerelease beta technical preview demo pre-RTM version. Lets consider it as 0.1.2020.03.08.666 prerelease beta technical preview demo pre-RTM version.
</p> </p>
<p> <p>
So you can lurk around and check other pages. I'm pretty sure they should be fine. @Localizer["But you still can lurk around and check other pages. I'm pretty sure they should be fine."]
</p> </p>
<dl> <dl>
<dt>Cheers,</dt> <dt>@Localizer["Cheers"],</dt>
<dd>Michael "XFox" Gordeev</dd> <dd>@SharedLocalizer["Michael \"XFox\" Gordeev"]</dd>
</dl> </dl>
<p hidden> <p hidden>
But anyway I should tell some more about it, shouldn't I? But anyway I should tell some more about it, shouldn't I?
@@ -1,12 +1,12 @@
@model ProjectsViewModel @model ProjectsViewModel
@{ @{
ViewData["Title"] = "My projects"; ViewData["Title"] = SharedLocalizer["My projects"];
} }
<header> <header>
<div> <div>
<h1>My projects</h1> <h1>@SharedLocalizer["My projects"]</h1>
<h3>Here is presented the most of projects I worked on</h3> <h3>@SharedLocalizer["Here is presented the most of projects I worked on"]</h3>
</div> </div>
<iframe src="//githubbadge.appspot.com/xfox111" class="github-stats" frameborder="0"></iframe> <iframe src="//githubbadge.appspot.com/xfox111" class="github-stats" frameborder="0"></iframe>
</header> </header>
@@ -36,7 +36,7 @@
} }
else else
{ {
<p style="margin: 0px 40px" class="comment">// No content available</p> <p style="margin: 0px 40px" class="comment">// @SharedLocalizer["No content available"]</p>
} }
</article> </article>
@@ -1,6 +1,6 @@
<li><a asp-area="" asp-controller="Home" asp-action="Index">AboutMe();</a></li> <li><a asp-area="" asp-controller="Home" asp-action="Index">@(SharedLocalizer["AboutMe"])();</a></li>
<li hidden><a href="//xfox111.blogspot.com/" target="_blank">MyBlog();</a></li> <li hidden><a href="//xfox111.blogspot.com/" target="_blank">@(SharedLocalizer["MyBlog"])();</a></li>
<li><a asp-area="" asp-controller="Resume" asp-action="Index">MyResume();</a></li> <li><a asp-area="" asp-controller="Resume" asp-action="Index">@(SharedLocalizer["MyResume"])();</a></li>
<li><a asp-area="" asp-controller="Projects" asp-action="Index">Projects();</a></li> <li><a asp-area="" asp-controller="Projects" asp-action="Index">@(SharedLocalizer["Projects"])();</a></li>
<li><a asp-area="" asp-controller="Gallery" asp-action="Index">Arts();</a></li> <li><a asp-area="" asp-controller="Gallery" asp-action="Index">@(SharedLocalizer["Arts"])();</a></li>
<li><a asp-area="" asp-controller="Contacts" asp-action="Index">Contacts();</a></li> <li><a asp-area="" asp-controller="Contacts" asp-action="Index">@(SharedLocalizer["Contacts"])();</a></li>
@@ -28,16 +28,16 @@
RenderSection("OpenGraph"); RenderSection("OpenGraph");
else else
{ {
<meta name="author" content="Michael 'XFox' Gordeev" /> <meta name="author" content="@SharedLocalizer["Michael \"XFox\" Gordeev"]" />
<meta name="description" content="Hi, my name is Michael. I'm C# Developer and this is my personal website. Here you can find info about me, my projects and more. Check it out!" /> <meta name="description" content="@SharedLocalizer["Hi, my name is Michael. I'm C# Developer and this is my personal website. Here you can find info about me, my projects and more. Check it out!"]" />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:site_name" content="XFox111.NET" /> <meta property="og:site_name" content="XFox111.NET" />
<meta property="og:url" content="//XFox111.NET/" /> <meta property="og:url" content="//XFox111.NET/" />
<meta property="og:locale" content="en_US" /> <meta property="og:locale" content="@SharedLocalizer["en"]" />
<meta property="og:image" content="~/images/me.png" /> <meta property="og:image" content="/images/me.png" />
<meta property="og:description" content="Hi, my name is Michael. I'm C# Developer and this is my personal website. Here you can find info about me, my projects and more. Check it out!" /> <meta property="og:description" content="@SharedLocalizer["Hi, my name is Michael. I'm C# Developer and this is my personal website. Here you can find info about me, my projects and more. Check it out!"]" />
<meta property="og:title" content="Michael 'XFox' Gordeev - Personal website" /> <meta property="og:title" content="@SharedLocalizer["Michael \"XFox\" Gordeev"] - @SharedLocalizer["Personal website"]" />
} }
} }
@@ -53,7 +53,7 @@
</menu> </menu>
<div> <div>
<a asp-controller="Home" asp-action="SwitchLanguage" lang="ru">РУС &#xE12B;</a> <a asp-area="" asp-controller="Home" asp-action="SwitchLanguage" lang="@SharedLocalizer["ru"]">@SharedLocalizer["РУС"] &#xE12B;</a>
<a id="menu-toggle" onclick="ToggleMenu();">&#xE700;</a> <a id="menu-toggle" onclick="ToggleMenu();">&#xE700;</a>
</div> </div>
</nav> </nav>
@@ -68,7 +68,7 @@
else else
{ {
<footer> <footer>
<span class="comment">// Copyright &copy;@(DateTime.Today.Year) Michael "XFox" Gordeev</span> <span class="comment">// @SharedLocalizer["Copyright"] &copy;@(DateTime.Today.Year) @SharedLocalizer["Michael \"XFox\" Gordeev"]</span>
<div> <div>
@foreach (LinkModel link in Model.Links.Where(i => i.DisplayInFooter).OrderBy(i => i.Order)) @foreach (LinkModel link in Model.Links.Where(i => i.DisplayInFooter).OrderBy(i => i.Order))
@@ -1,4 +1,8 @@
@using MyWebsite @using MyWebsite
@using MyWebsite.Models @using MyWebsite.Models
@using MyWebsite.ViewModels @using MyWebsite.ViewModels
@using Microsoft.AspNetCore.Mvc.Localization
@inject IViewLocalizer Localizer
@inject IHtmlLocalizer<SharedResources> SharedLocalizer
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
+1 -1
View File
@@ -5,7 +5,7 @@
<handlers> <handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers> </handlers>
<aspNetCore processPath=".\XFox111dotNET.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" /> <aspNetCore processPath=".\MyWebsite.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
</system.webServer> </system.webServer>
</location> </location>
</configuration> </configuration>
+2 -7
View File
@@ -130,7 +130,7 @@ header
} }
/* Adaptive code */ /* Adaptive code */
@media only screen and (min-width: 1080px) @media only screen and (min-width: 980px)
{ {
menu menu
{ {
@@ -164,9 +164,4 @@ header
{ {
margin: 16px 20px; margin: 16px 20px;
} }
} }
nav > div > a:nth-last-child(2)
{
visibility: hidden;
}