aksoftware98 / multilanguages

AKSoftware.Localization.MultiLanguages is a package for .NET developers allows them to easily build apps target multiple languages with just few lines of code
MIT License
85 stars 14 forks source link

akmultilanguages with shared project structure #53

Closed gheith3 closed 1 week ago

gheith3 commented 11 months ago

This guide provides a step-by-step solution for sharing akmultilanguages library within a shared project structure that includes a MAUI Blazor app and a Blazor website.

Project Structure

Steps

  1. Inside the Blazor Components Library Install the package. Create a resources folder and add your resource files.
  2. Modify the .csproj File Add the following line to the section of the .csproj file for the Blazor Components Library:
<PropertyGroup>
    ...
    <AssemblyName>your-project-assembly-name</AssemblyName>
</PropertyGroup>

Replace your-project-assembly-name with the actual assembly name for your project.

  1. In the MAUI Blazor App Add the package to your MAUI Blazor App project. Use the following code to configure the services:
builder.Services.AddLanguageContainer<EmbeddedResourceKeysProvider>(
    Assembly.Load("your-project-assembly-name"),
    "Resources");

Replace your-project-assembly-name with the actual assembly name you set in the Blazor Components Library.

Example Here's an example of the final folder structure:

- Blazor Components Library
    - Resources
        - YourResourceFile.resx
    - BlazorComponentsLibrary.csproj

- MAUI Blazor App
    - ...
    - MauiProgram.cs

- Blazor Website
    - ...
    - Program.cs
aksoftware98 commented 11 months ago

@gheith3 Thank you so much for this huge contribution, I will make sure to create the right Wiki pages this weekend and include this documentations inside

gheith3 commented 11 months ago

thank you, im more than welcome to working in this project, if i can do more things just tell me

GregFinzer commented 1 week ago

Solved with PR https://github.com/aksoftware98/multilanguages/pull/63