What is your product version: v11.1.0 What is your product type (Angular or MVC): ASP.NET CORE & Angular What is product framework type: .net core
is it possible to insert a line break into a language (xml) file?
for example, we have SweetAlert warning messages like below
<text name ="InvalidProjectDeleteWarning" value="Failed to delete project {0} still has tasks." />
If we wanted to insert a line-break where there is a {0}, can that be done?
9 Answer(s)
-
0
Hi,
You can use html tags as we do here https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/Localization/AbpZeroTemplate/AbpZeroTemplate.xml#L410
So, if you pass HTML to {0}, it should work.
-
0
-
0
Hi @XugoWebTeam
I think you also need to render it in a different way. Could you share how do you render it now ?
-
0
Hi @ismcagdas,
'how do I render it?'
If you're referring to how I insert the language file file reference, its simply by adding it into the .html
so for example:
<p>{{"DashboardNoteForMpaVersion" | localize}}</p>
if you try that on your own copy of aspnetzero does the html get parsed, or does it get output as plain text?
The original scenario that I want to get this working in, is - inserting some <br /> and<strong> tags into those SweetAlert popup messages.
-
0
UPDATE - for the basic example above, i've got that working by using innerHTML:
<p [innerHTML]="l('DashboardNoteForMpaVersion')"></p>
now trying to figure out SweetAlert notifications...
-
0
Hi @ismcagdas - below is the situation I'm trying to insert HTML:
TS NoteShareWarningMessage has the html
shareNote(note) { let self = this; if (!self._linkbarService.isNewCoreObject) { self.message.confirm( self.l('NoteShareWarningMessage', self.htmlToPlaintext(note.bodyText)), '', (isConfirmed) => { if (isConfirmed) { self._noteService.share(note).subscribe(() => { self.notify.success(self.l('SuccessfullyShared')); this._linkbarService.shareNote(note); }); } } ); } else { this._linkbarService.shareNote(note); } }
Language File:
<text name="NoteShareWarningMessage"> <![CDATA[ Note <strong{0}</strong><br /> will be shared. ]]> </text>
-
0
Hi,
You can use a syntax as shown below;
this.message.warn("HTML Message", "Title", { isHtml: true });
-
0
@ismcagdas - thanks - working now!
-
0
Great :)