How can I update the text "Signin / Register" of LoginComponent to "Login" in Spartacus? - spartacus-storefront

I would like to change the text in LoginComponent from "Signin/Register" to "Login". What is the best way to achieve this in Spartacus Storefront?

https://sap.github.io/spartacus-docs/i18n/#overwriting-individual-translations
You have to find the chunk + key in the source code, then provide your own translation for the given key

Related

How can we export translatable fields content in Odoo?

In Odoo (16), I would like to export all my translatable fields content to a file so I can easily edit it and translate to new languages.
I already know how to edit one by one, in the screen, but for what is a growing set of data it will take more time that translate it using a proper program (example: PoEdit).
Here is part of my model definition
class Card(models.Model):
_name = "carddecks.card"
_description = "Card"
cardText = fields.Char("Card Text", required=True, translate=True)
And now I can also see the language icon in the Card form, so I can edit it there.
How do I manage to export a po file with all the content?
All I can get from Settings -> Translations -> Export Translation is a set of field labels. Not field content...
Any ideas on how to accomplish this?
In debug mode via Technical Settings there should be a menu item named Translated Terms

media queries and styled components

I like to have all the media queries at one place, usually in the App.css file because when I want to change something depending on the size I see all the components involved at once.
I am looking for a nice way to do so with styled components. There styles are usually attached to the file where the styled components are defined. I don't want to use wrappers to refer to them with className.
Does someone has a good way to handle this?
After a discussion following solution came up:
const reducer = (accumulated, [condition, css]) =>
accumulated +
`
#media(${condition}) {
${css[componentName]}
}
`
const addMedia = componentName => Object.entries(theme.media).reduce(reducer, "")
Now you have all the media queries at one place and you need just to add them within the styled component via:
${addMedia("componenName")}

Macro to replace/encapsulate text in PhpStorm/IntelliJ?

For example I have the text login and I want to wrap in in a function call like {{ __('login') }} by just selecting the text and hitting a key combination to perform the change for me, speeding up my work flow.
Is there a way of doing this with PhpStorm/IntelliJ?
Thanks to #LazyOne for providing info; i want to expand according to your question.
your template text will be as following if you want to surround texts like login;
{{ __('$SELECTION$') }}$END$
or if you want surround texts like 'login'
{{ __($SELECTION$) }}$END$
After you finalize your live template by selecting applicable context, it will be ready to use. When you type and select login, then hit cmd + alt + j it will surround.
Another option would be creating a live template which will print everything in the template but you fill login.
{{ __('$NAME$') }}$END$

Add target blank to a link in a props in Vue.js

I use the ReadMore plugin to crop articles in a page. The plugin provides a props to redirect to a http link when the "read more" is clicked. But I need to display the link in a new tab. The props receives the link in a string.
I tried several ways to add the target blank attribute to this string before passing it to the props. With no success. Like:
http://www.example.com/page-to-see.html target=_"blank"
I used it with or without quotes but in any case, the link works but the attribute is skipped.
Is there a way to intercept this and add a target blank later?
I saw in other questions the use of router-link but I don't know how to manipulate the props content in the first place.
Any clue would be warmly welcomed
Edit: adding more code to give a clearer explanation of the problem I try to solve:
In the template:
<read-more more-str="read more" :text="dwId.texte" :link="dwId.link" less-str="less" :max-chars="540"></read-more>
I get the values from a DB with Axios. The props are specified by the plugin documentation.
The :link must be a string and it's what it gets from the DB. It works. But as I explained, I need to open in a new tab.
Edit: what I tried:
I try to make a computed property that would add the target blank to a string and use it in the read-more props:
computed: {
target: function() {
return this.dwIds.filter((dwId) => {
return dwId.link + target="_blank"
});
},
}
I have two issues here: first , the result is an object and the props requires a string. Furthermore, the way I add the target blank is not correct but I can't find the right syntax yet.
You need to use it as a directive, and override parts of the initial element you're passing. Otherwise there is no way to "intercept" it. Here's the code to the "component" version that won't do the trick for you.

The best Xpath option for the below example

Please let me know the best xpath for the below HTML, the button id's are dynamically populated. Hence I tried using the starts-with function as below
driver.findElement(By.xpath("*//button[starts-with(#id, 'j_idt')]")).click();
but, how to achieve if we have two buttons in the same page as per the attached screenshot.
There are multiple ways to find the button. One of the options is to rely on the text inside, e.g. for Login:
//button[span = 'Login']
Then, you can add other checks, e.g. check if it is of type submit:
//button[#type = 'submit' and span = 'Login']