- Setting CurrentUICulture to the application
- Localize application level
Contact Support
Localization in .NET MAUI AI AssistView (SfAIAssistView)
Localization
is the process of translating the application resources into different languages for specific cultures. The SfAIAssistView can be localized by adding a resource
file.
Setting CurrentUICulture to the application
Application culture can be changed by setting the CurrentUICulture
in the App.xaml.cs
file.
using Syncfusion.Maui.AIAssistView;
using System.Globalization;
using System.Resources;
namespace MauiAssistView
{
public partial class App : Application
{
public App()
{
InitializeComponent();
CultureInfo.CurrentUICulture = new CultureInfo("es");
SfAIAssistViewResources.ResourceManager = new ResourceManager("MauiAssistView.Resources.SfAIAssistView", Application.Current!.GetType().Assembly);
MainPage = new MainPage();
}
}
}
NOTE
The required
resx
files withBuild Action
asEmbeddedResource
(File name should contain culture code) into theResources
folder.
Localize application level
To localize the AI AssistView
based on the CurrentUICulture
using the resource
files, follow these steps.
-
Create a new folder named
Resources
in the application. -
Right-click on the
Resources
folder, selectAdd
, then click onNewItem
. -
In the Add New Item wizard, select the Resource File option and name the filename as
SfAIAssistView.<culture name>.resx
. For example, give the name asSfAIAssistView.es.resx
for Spanish culture. -
The culture name indicates the name of the language and country.
- Now, select
Add
option to add the resource file in the Resources folder.
- Add the Name or Value pair in the Resource Designer of
SfAIAssistView.es.resx
file and change its corresponding value to corresponding culture.