Skip to content
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

Feature/ja-25 add localization #121

Merged
merged 32 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
170379b
Add basic setup and dropdown menu to change languages
GrzegorzKmiecinski Jul 4, 2024
05da560
Add layout menu translations
GrzegorzKmiecinski Jul 4, 2024
9b4b014
Change resource name
GrzegorzKmiecinski Jul 4, 2024
d900708
Add AdRequestStatusForAd localization
GrzegorzKmiecinski Jul 4, 2024
1ada8a0
Add AvailableScheduleForAd localization
GrzegorzKmiecinski Jul 4, 2024
5f173c7
Add CreateRequestForAd localization
GrzegorzKmiecinski Jul 4, 2024
b2e064f
Add TutorsScheduleForAd localization
GrzegorzKmiecinski Jul 4, 2024
12b13a7
Add _AdListItem localization
GrzegorzKmiecinski Jul 4, 2024
df000a3
Add _AdRequest localization
GrzegorzKmiecinski Jul 4, 2024
dec28d4
Add _PendingAdRequestsListItem localization + some fixes in localizat…
GrzegorzKmiecinski Jul 4, 2024
b38c991
Add _TutorAllAdRequestsListItem localization
GrzegorzKmiecinski Jul 4, 2024
4b0614b
Add account localization
GrzegorzKmiecinski Jul 4, 2024
4b06a1d
Add account localization
GrzegorzKmiecinski Jul 4, 2024
cd69a1b
fix account view
GrzegorzKmiecinski Jul 4, 2024
d2ea6e5
fix account view
GrzegorzKmiecinski Jul 4, 2024
2903b77
Merge branch 'feature/ja-25-add-locatization' of https://github.com/i…
GrzegorzKmiecinski Jul 4, 2024
25bf7cb
fix
GrzegorzKmiecinski Jul 4, 2024
92c6c22
hotfix
GrzegorzKmiecinski Jul 4, 2024
d3b4556
Add Ad localization
GrzegorzKmiecinski Jul 5, 2024
37aed89
Add AdRequest localization
GrzegorzKmiecinski Jul 5, 2024
675b9f0
Add Browse localization
GrzegorzKmiecinski Jul 5, 2024
c01b8e1
Add Category localization
GrzegorzKmiecinski Jul 5, 2024
935f5b8
Add Home localization
GrzegorzKmiecinski Jul 5, 2024
aea72bc
Add ScheduleItem localization
GrzegorzKmiecinski Jul 5, 2024
54a5070
bugfix
GrzegorzKmiecinski Jul 5, 2024
29f4ccb
Add ScheduleItemRequest localization
GrzegorzKmiecinski Jul 5, 2024
4f6195d
Add Student localization
GrzegorzKmiecinski Jul 5, 2024
6882307
Add Tutor localization
GrzegorzKmiecinski Jul 5, 2024
ec114e2
Add User localization
GrzegorzKmiecinski Jul 5, 2024
9722921
Requested changes & fixes
GrzegorzKmiecinski Jul 5, 2024
a70518d
Hotfix
GrzegorzKmiecinski Jul 5, 2024
6d7f8d1
Merge branch 'develop' into feature/ja-25-add-locatization
Zjyslav Jul 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions TutorLizard.Web/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using System.Globalization;
using TutorLizard.Web.Models;

namespace TutorLizard.Web.Controllers;
Expand Down Expand Up @@ -36,4 +37,24 @@ public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
public IActionResult ChangeLanguage(string language, string returnUrl)
{
if (!string.IsNullOrEmpty(language))
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(language);
Thread.CurrentThread.CurrentUICulture = new CultureInfo(language);
}
else
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
}

Response.Cookies.Append("Language", language);

if (returnUrl is null)
return RedirectToAction("Index", "Home");

return Redirect(returnUrl);
}
}
16 changes: 16 additions & 0 deletions TutorLizard.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@
});

app.UseRouting();
app.Use(async (context, next) =>
{
string cookie = string.Empty;
if (context.Request.Cookies.TryGetValue("Language", out cookie))
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(cookie);
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(cookie);
}
else
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("pl");
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("pl");
}

await next.Invoke();
});

app.UseAuthentication();
app.UseAuthorization();
Expand Down
153 changes: 153 additions & 0 deletions TutorLizard.Web/Resources/Account.Designer.cs

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

150 changes: 150 additions & 0 deletions TutorLizard.Web/Resources/Account.en.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
<?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="AccessDenied" xml:space="preserve">
<value>Access denied</value>
</data>
<data name="AccountActivated" xml:space="preserve">
<value>Your account has been activated.</value>
</data>
<data name="AccountActivation" xml:space="preserve">
<value>Account activation</value>
</data>
<data name="GoogleSignUp" xml:space="preserve">
<value>Sign up with Google</value>
</data>
<data name="Login" xml:space="preserve">
<value>Log in</value>
</data>
<data name="LoginWithGoogle" xml:space="preserve">
<value>Login with Google</value>
</data>
<data name="Password" xml:space="preserve">
<value>Password</value>
</data>
<data name="Register" xml:space="preserve">
<value>Register</value>
</data>
<data name="RegisterWithGoogle" xml:space="preserve">
<value>Register with Google</value>
</data>
<data name="Username" xml:space="preserve">
<value>Username</value>
</data>
</root>
Loading
Loading