-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Localization for elsa studio. * Latest Changes. * WIP Localization Module * cleanup * BlazorServer implementation * Elsa studio changes for Localization. * Update localization options * refactoring * Added translation for components. * Deleted Unused resource files. * Fix build * Removed extra localization files and added missing translations. * add controllers * Fix Imports * Reconfigure Localization Service with the ResourceManager * Add Blazor Wasm Localization * Refactor LocalizationService * Rename Localization Service * Translation added for Agents and Secrets. * refactoring * merge from soumya * Refactor localization * cleanup resources * additional cleanup * Delete Japanese localization * clean up * remove specific functions * Add a README for localization * Update localization * Fix merge errors * fix formatting * Use Timestamp component * Implement ILocalizer interface and replace ElsaLocalization Created a new ILocalizer interface for localization purposes. Replaced ElsaLocalization with ILocalizer throughout the codebase for consistency and better readability. Removed unnecessary using statements and simplified namespaces. * Remove unused using directives across the project Cleared redundant using directives from ILocalizationProvider, DefaultLocalizer, and ActivityWrapper components. This cleanup improves code readability and may slightly enhance compilation performance. * Refactor constructors to use parameterized field assignment Converted multiple class constructors to use parameterized field assignment directly in the constructor. This change reduces boilerplate code and improves readability. Additionally, some unnecessary using directives were removed. * Add XML documentation to DashboardMenu class Added summary XML documentation to the DashboardMenu class and the GetMenuItemsAsync method to enhance code readability and maintainability. This documentation provides a brief description of the class's purpose and the method's functionality. * Update language picker to use customizable formatter This change updates the `LanguagePicker` component to utilize a customizable formatter defined in `LocalizationOptions`. It allows for more flexibility in how culture names are displayed in the UI, enhancing localization support. The default formatter is set to use the culture's display name. * Update culture picker to use culture name Changed the CulturePickerFormatter to use the culture's Name property instead of DisplayName. This ensures consistency in the format used for culture identifiers. --------- Co-authored-by: Soumya Mandal <[email protected]> Co-authored-by: Mohamed Ali <[email protected]> Co-authored-by: Sipke Schoorstra <[email protected]>
- Loading branch information
1 parent
d72092d
commit 5ac5272
Showing
124 changed files
with
2,370 additions
and
601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Description>Core Elsa Studio services.</Description> | ||
<PackageTags>elsa studio core</PackageTags> | ||
<RootNamespace>Elsa.Studio</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0'"> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization"/> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.CustomElements"/> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.Web"/> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions"/> | ||
<PackageReference Include="Microsoft.JSInterop"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'"> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization"/> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.CustomElements"/> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.Web"/> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions"/> | ||
<PackageReference Include="Microsoft.JSInterop"/> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.CustomElements" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.ResxSourceGenerator"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" /> | ||
<PackageReference Include="Microsoft.JSInterop" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Blazored.FluentValidation"/> | ||
<PackageReference Include="Blazored.LocalStorage"/> | ||
<PackageReference Include="CodeBeam.MudBlazor.Extensions"/> | ||
<PackageReference Include="FluentValidation"/> | ||
<PackageReference Include="MudBlazor"/> | ||
<PackageReference Include="Radzen.Blazor"/> | ||
<PackageReference Include="ShortGuid"/> | ||
<PackageReference Include="ThrottleDebounce"/> | ||
<PackageReference Include="Blazored.FluentValidation" /> | ||
<PackageReference Include="Blazored.LocalStorage" /> | ||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" /> | ||
<PackageReference Include="FluentValidation" /> | ||
<PackageReference Include="MudBlazor" /> | ||
<PackageReference Include="Radzen.Blazor" /> | ||
<PackageReference Include="ShortGuid" /> | ||
<PackageReference Include="ThrottleDebounce" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Update="**\*.resx"></EmbeddedResource> | ||
</ItemGroup> | ||
|
||
<!-- <ItemGroup Label="Elsa">--> | ||
<!-- <ProjectReference Include="..\..\..\..\..\elsa-core\main\src\clients\Elsa.Api.Client\Elsa.Api.Client.csproj"/>--> | ||
<!-- </ItemGroup>--> | ||
|
||
<ItemGroup Label="Elsa"> | ||
<PackageReference Include="Elsa.Api.Client"/> | ||
<PackageReference Include="Elsa.Api.Client" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/framework/Elsa.Studio.Core/Localization/DefaultLocalizationProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Globalization; | ||
using Elsa.Studio.Resources; | ||
|
||
namespace Elsa.Studio.Localization | ||
{ | ||
internal class DefaultLocalizationProvider : ILocalizationProvider | ||
{ | ||
public string? GetTranslation(string key) | ||
{ | ||
return ResourceLocalization.ResourceManager.GetString(key, CultureInfo.CurrentUICulture); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/framework/Elsa.Studio.Core/Localization/DefaultLocalizer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Microsoft.Extensions.Localization; | ||
|
||
namespace Elsa.Studio.Localization | ||
{ | ||
/// <inheritdoc /> | ||
public class DefaultLocalizer(ILocalizationProvider provider) : ILocalizer | ||
{ | ||
/// <inheritdoc /> | ||
public LocalizedString this[string key] | ||
{ | ||
get | ||
{ | ||
var notFound = false; | ||
var translation = provider.GetTranslation(key); | ||
|
||
if (translation is null) | ||
{ | ||
translation = key; | ||
notFound = true; | ||
} | ||
|
||
return new LocalizedString(key, translation, notFound); | ||
} | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/framework/Elsa.Studio.Core/Localization/ILocalizationProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Elsa.Studio.Localization | ||
{ | ||
public interface ILocalizationProvider | ||
{ | ||
string? GetTranslation(string key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Microsoft.Extensions.Localization; | ||
|
||
namespace Elsa.Studio.Localization; | ||
|
||
/// <summary> | ||
/// Interface for localization. | ||
/// </summary> | ||
public interface ILocalizer | ||
{ | ||
/// <summary> | ||
/// Gets the localized string for the given key. | ||
/// </summary> | ||
/// <param name="key"></param> | ||
LocalizedString this[string key] { get; } | ||
} |
Oops, something went wrong.