Aurelia i18n HTML attributes with namespace - i18next

How is it possible to select the proper namespace when translating html attributes? The default syntax is like:
<span i18n="home.title">Title</span>
For instance, in the view model the approach is the following:
this.i18n.tr('invalidName', {ns: 'errors'})
I'm using version 0.5.3 of aurelia-i18n.

The best options I would suggest are:
<span t="errors:invalidName"></span>
<span t="invalidName" t-params.bind="{ns: 'errors'}"></span>
<span>${'errors:invalidName' | t & signal:'aurelia-translation-signal}</span>
<span>${'invalidName' | t:{ns: 'errors'} & signal:'aurelia-translation-signal}</span>

Related

Optional non-boolean attribute in ASP.NET Core 7 Razor

I want <li></li> or <li aria-current="page"></li> depending on some condition.
I tried:
<li #(current == Model.CurrentPage ? #"aria-current=\"page\"" : "") ></li>
Which gives the incorrect result:
<li aria-current=""page""></li>
There have been many changes in Razor over the years. In v7, is there an easy one-liner way to do this? (Without multiline if/else statements, tag helpers, etc.)
(Note that the boolean attribute rendering trick doesn't work here, as I want <li></li> rather than <li aria-current=""></li>.)
I tried as below:
<li  aria-current=#(current==Model.Page? "page":null )></li>
The result:
Is this what you want?

How to bind multiple class in vueJs

I want to bind multiple class by vueJs but the code does not work. I am following the vue documentation of class binding topics. I am not able to find my error.
<a href="#" :class="[badge, badge-primary, ladda-button]>
It's just formatted incorrectly.
:class="badge badge-primary ladda-button"
or....
:class="['badge', 'badge-primary', 'ladda-button']

Selenium Python, extract text from node and ALL child nodes

I have the opposite problem described here. I can't get the text more than one layer deep.
HTML is structured in the following manner:
<span class="data">
<p>This text is extracted just fine.</p>
<p>And so is this.</p>
<p>
And this.
<div>
<p>But this text is not extracted.</p>
</div>
</p>
<div>
<p>And neither is this.</p>
</div>
</span>
My Python code looks something like this:
el.find_element_by_xpath(".//span[contains(#class, 'data')]").text
Try the same with child elements:
print(el.find_element_by_xpath(".//span[contains(#class, 'data')]").text)
print(el.find_element_by_xpath(".//span[contains(#class, 'data')]/div").text)
print(el.find_element_by_xpath(".//span[contains(#class, 'data')]/p").text)
Not sure what's the referred el in your original post. But able to get all the text using the below.
driver.find_element_by_xpath("//span[#class='data']").text
Output:
'This text is extracted just fine.\nAnd so is this.\nAnd this.\nBut this text is not extracted.\nAnd neither is this.'
Instead of relying on WebElement.text property consider querying innerText property
Consider using Explicit Wait as it will make your test more robust and reliable in case if the element you're looking for is loaded by i.e. AJAX call
Assuming all above:
print(WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//span[#class='data']"))).get_attribute("innerText"))
Demo:

TYPO3 Flux create extendable link list

I want to create an extendable list of links with flux. That means I want a backend form to create and add as many links as needed. Using TYPO3 8.7, Flux, Fluidcontent, VHS. How do I do that?
Output Html shall look like this:
<h3>Links Headline </h3>
<ul class="mylist">
<li>Linktext one</li>
<li>Linktext two</li>
...
</ul>
Seems to be very simple, but I haven´t found a solution for it yet.
Thanks for advices
You can do this by creating a section in your flux configuration.
<flux:form.section name="settings.linklist" label="Definitions">
<flux:form.object name="listitem" label="Definition">
<flux:field.input name="label" label="Label"/>
<flux:field.input name="link" label="Link">
<flux:wizard.link/>
</flux:field.input>
</flux:form.object>
</flux:form.section>
Rendering the list in the frontend with:
<f:for each="{settings.linklist}" as="item">
For further information see the documentation: https://fluidtypo3.org/viewhelpers/flux/master/Form/SectionViewHelper.html

Dynamic css classes (angular like) in phalcon volt

Is there a way to selectively apply a class in volt (the Phalcon template engine) based on variables?
I have come to working in volt from js libraries like Angular and Vue, which have structure like:
ng-class="{'active':thing >= 1}"
Where a class is applied based on the statement being true. In Volt I could use if blocks to selectively render html but was wondering if there is a similar syntax?
Is this what you are looking for?
<a class="button {% if something == 12 %}active{% endif %}">Link</a>
Or you can use ternary operators:
<a class="button {{ something == 12 ? 'active' : 'disabled' }}">Link</a>