that was the solution ;)
thanks !
No I don't. It's still in English.
In the AbpSettings table, the language setting has not been set for my public user.
I can maybe provide the full code for public user creation :
private async Task<AuthenticateResultModel> PublicAuthenticationForTenantId(int tenantId)
{
using (AbpSession.Use(tenantId, null))
{
using (UnitOfWorkManager.Current.SetTenantId(tenantId))
{
var password = ...;
var userName = $"{Guid.NewGuid():N}";
Authorization.Users.User.CreateTenantAdminUser(AbpSession.TenantId.Value,
$"{userName}@public.com");
publicUser.UserName = userName;
publicUser.Name = StaticUserPublic.Name;
publicUser.Surname = StaticUserPublic.Surname;
publicUser.IsEmailConfirmed = true;
publicUser.ShouldChangePasswordOnNextLogin = false;
publicUser.IsActive = true;
publicUser.Password = new PasswordHasher<User>(new OptionsWrapper<PasswordHasherOptions>(new PasswordHasherOptions())).HashPassword(publicUser, password);
publicUser.Roles = new Collection<UserRole>(); var role = await _roleManager.GetRoleByNameAsync(StaticRoleNames.Tenants.Public);
publicUser.Roles.Add(new UserRole(AbpSession.TenantId, publicUser.Id, role.Id));
CheckErrors(await _userManager.CreateAsync(publicUser));
var defaultLanguage = _settingManager.GetSettingValueForTenant(LocalizationSettingNames.DefaultLanguage, tenantId);
_settingManager.ChangeSettingForUser(publicUser.ToUserIdentifier(), LocalizationSettingNames.DefaultLanguage, defaultLanguage);
CurrentUnitOfWork.SaveChanges(); //To get new user's Id.
return await Authenticate(new AuthenticateModel
{
UserNameOrEmailAddress = publicUser.UserName,
Password = password,
RememberClient = true,
SingleSignIn = false
});
}
}
}
My solution is to change the AppService method signature to return a JSON string. I then transform and parse that string when received in the frontend.
In order to make it work, I had to do the following :
This is tedious and it breaks the webAPI contract but I haven't found a better solution to optimize the size of the transferred JSON. If someone comes up with a better solution, please share.
Thanks
I think that since this JSON response is returned by the AppService, it should be handled first on the server side, shouldn't it ?
Where does the AppService format the returned object to JSON ?
I see now. Thanks.
For further reference, two things are necessary to achieve what I need :
In the localization files, html must be enclosed in CDATA tags :
<text name="MyTextKey"><![CDATA[<span><b>MyText</b><br/>is formatted in the current language</span>]]></text>
In order for the html to be rendered on the client, assign it to the innerHtml of a span element :
<span [innerHtml]="l('MyTextKey')"></span>
And voilà :-)
Whether I call the l() function in my html template or in my javascript code will not make a difference, since the string values in my App-xx.xml can't have html tags.
So where do I store the html translations ? And how do I display them to the user ?
Said otherwise : I need to display very long formatted texts in several different languages. The texts are provided to me in a Word document, which I then convert to html (in order to keep the formatting). The conversion result is what I want to display (according to the current language). In different languages, the html tags will be set on different parts of the text, which makes it impossible to have an html template and a lot of strings to translate between the tags.
I'm sorry but I see nothing about including html in translated text strings ?
Works fine. Thanks !
We have the same issue on our code. We just migrated from abpzero 6.4 (where null was translated to null) to 7.2.3 (where null is translated to an empty javascript object)
Your solution @abarref doesn't compile for us :
Property 'pipe' doesn't exist on type 'U'
observable = observable.pipe(map((data) => {
Any suggestion ?
Currently abp zero 6.4 with Angular and .net framework but we are now in the process of migrating to 7.2.3 so our problem will likely be solved.
Thank you.