Hi Yasin,
ABP supports all .net features hence it's not an issue unique to the framework. Even so, hopefully, this helps you to solve your problem.
Regards.
Hi Malik .
I found solving for my Problem from another resourecs
Thanks
Hi Yasin,
Could you config your website on IIS as the mention here, please?
- Open IIS 7
- Select your website
- Open .NET GLOBALIZATION
- From Culture tab, select required Culture and UI Culture.
- Do iisreset
It may related own configuration
Hi Malik ..
I set Culture and UI Culture to (en), the system converted to english as a default language and generate DateTime Gregorian .
but I want to set default language in arabic . when I set Culture and UI Culture to (ar), the system converted to arabic as a default
language and generate DateTime Hijri .
How can I set Default language in arabic and generate dateTime Gregorian .
Hi Yasin,
Could you config your website on IIS as the mention here, please?
- Open IIS 7
- Select your website
- Open .NET GLOBALIZATION
- From Culture tab, select required Culture and UI Culture.
- Do iisreset
It may related own configuration
Thanx . I will trying and tell you
Hi there .
We have issue related with datetime .
When run my app on local it generate datetime with Gregorian and it is ok like below
but when publish my app to iis server and run it generate datetime with hijri like below
I asked here because I think this issue related to abp .
I have another project on iis build in with asp.net pure without abp framework , it works well and generate datetime with Gregorian .
can you help me please .
sorry,
var defaultLanguage = await _settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); var (cultureName, uiCultureName) = LocalizationSettingHelper.ParseLanguageSetting(defaultLanguage); using (CultureHelper.Use(CultureInfo.GetCultureInfo(cultureName))) { GenerateViolationReport() }
Now it work well Thanx
hi
here I want to set defaultLanguage to use it in GenerateViolationReport() method
hi
You can switch the current culture
// get defaultLanguage for this tenant var defaultLanguage = await _settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); // here I want to set defaultLanguage to use it in GenerateViolationReport() method using (CultureHelper.Use(CultureInfo.GetCultureInfo(defaultLanguage))) { GenerateViolationReport() }
Hi bro .. I am sorry it gave me this error
System.Globalization.CultureNotFoundException: Culture is not supported. (Parameter 'name') ar;ar is an invalid culture identifier.
hi
The
LocalizationSettingNames.DefaultLanguage
is a setting so you can change via https://docs.abp.io/en/abp/latest/Settingshow I can use it to translate string
https://docs.abp.io/en/abp/latest/Localization
Hi bro ..
this is Excution method for backgrounJob Hangifire
public async Task Excute()
{
var tenants = await _tenantRepository.GetListAsync();
foreach (var tenant in tenants)
{
using (_currentTenant.Change(tenant.Id))
{
// get defaultLanguage for this tenant
var defaultLanguage = await _settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage);
// here I want to set defaultLanguage to use it in GenerateViolationReport() method
//...
//...
var absenceAssignmentEmployees = await GetAbsenceAssignmentEmployees();
var toBeReported = await GenerateAbsenceReport(absenceAssignmentEmployees);
if (toBeReported.Any())
{
await _absenceRepository.InsertManyAsync(toBeReported, autoSave: true);
var absenceIds = toBeReported.Select(absence => absence.Id).ToList();
// get absences with related data
var absences = await _absenceRepository.GetAbsencesByAbsenceIdsWithDetailsAsync(absenceIds);
//TODO EntityLogs
var violations = await GenerateViolationReport(absences);
if (violations.Any())
{
await _violationRepository.InsertManyAsync(violations, autoSave: true);
//TODO EntityLogs
}
}
}
}
}
I read this documnet https://docs.abp.io/en/abp/latest/Settings and saw this way :
public class MySettingDefinitionProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
var smtpHost = context.GetOrNull("Abp.Mailing.Smtp.Host");
if (smtpHost != null)
{
smtpHost.DefaultValue = "mail.mydomain.com";
smtpHost.DisplayName =
new LocalizableString(
typeof(MyLocalizationResource),
"SmtpServer_DisplayName"
);
}
}
}
but I did not know way to set DefaultLanguage from My code
can you help me Pls ....
Thanx..
var defaultLanguage = await settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage);
thanks ... what is the next step ..
how I can set DefaultLanguage in my code
how I can use it to translate string
I want to set the specified language for the tenant in the backgroundJob Hangfire
example: if the tenant is arabic language I want to set language arabic ...
How I can implementation that please ...