Currency switcher without language change - vue.js

I want to create currency switcher based on i18n nuxt, but without changing language.
I know that we can change currency by $i18n.setLocale(*localeCode*) but this also change language. Is it somehow possible to change only currency and display it properly using <i18n-n>?

Related

Custom shipping method admin form issues

I've created a custom shipping integration (based on this guide) that calculates the shipping price based on a percentage of the subtotal. This percentage is set in the shipping method settings.
Everything works fine on the frontend part, the shipping price is calculated correctly.
The problems I have lies in the admin backoffice, in the shipping method settings page. The first problem that I have is that the text box to set the percentage is preceded by the currency, which will confuse the user as it is expecting not a flat rate price, but a percentage of the order's subtotal.
I have the same problem on the list of added shipping methods, the value I set is preceded by the currency, and this is not good.
There is a "add a template" section in the guide which I followed, but the template doesn't seem to affect anything. I tried putting bogus letters in the template and clearing the cache, but they did not appear anywhere on the settings page.
What I would like to do here is either remove the currency indicator completely, or to replace it with a %.
The second problem I have is that the language isn't taken into account. I have created a messages.en.yml file and a messages.fr.yml file. Both follow the same structure of course, and all strings are translated. But if I set OroCommerce in French, I don't get my translated strings, but the english ones.
Here's a screenshot that shows both my problems :
(Strings like "Price percentage" should be translated)
Do you have an idea on how I could fix these issues? Thanks.
Currency is added in shipping-rule-method-view.js. You can override this JS view with the map section in jsmodules.yml configuration file.
Based on Andrey's answer, I managed to have something that works. I'll add a few more details for anyone that had the same issue.
For the issue with the translation, it seems that renaming the file by adding the locale messages.fr_FR.yml fixed the issue.
Concerning the currency part on the admin menu, you have to create a jsmodules.yml file in the Resources/config folder of your bundle, NOT Resources/config/oro, which is why none of my configs were taken into account.
When writing your jsmodules file, when using map, if you're overriding a JS file, you have to omit the file extension. When you're overriding something else, say an HTML file, you have to put the file extension.
This is how my file is written :
map:
"*":
oroshipping/js/app/views/shipping-rule-method-view: gdmshipping/js/shipping-rule-method-view
There is one caveat, though. This will replace the display for all shipping integrations, so the currency symbol will be replaced/removed for all other shipping types, such as Flat Rate, so keep this in mind.

Changing date format Prestashop backoffice to DD-MM-YYYY

I want to change the date format Prestashop using in BackOffice especially in Edit product > quality tab > available date, from YYYY-MM-DD to DD-MM-YYYY. I managed to do it in javascript but in the ps_product table I want it to keep the YYYY-MM-DD format because Prestashop validate dates in Validate.php class and I don't want to touch core files.
The library used is datetimepicker and the format option doesn't support toDisplay and toValue as the datepicker library.
Any idea to do so?
The format of the dates displayed in Prestashop is tied to the Language configuration.
The language chosen depends on the one defined for the backoffice admin user or the one chosen by the customers / visitors.
Assuming you are on Prestashop 1.7.x, this can be changed under:
Backoffice > International > Localization > Language tab.

Shopify - is it possible to change the preview of a product with a inputbox?

Which ways are possible to edit the live preview of the product page in Shopify with Inputboxes next to it?
Let's say the product is a poster, and i want to add a custom text on it.
When typing into the inputbox the text changes in real time on the product.
Can this be implemented in the shopify code with the basic version of shopify?
Or does this necessarily needs an app?
ADDITIONALLY:
Let me go a bit deeper. I have a code that can generate a QR code.
Now i want that the QR code to be previewed in the product. Now position and color of the QR code is different from any product. Would that need an app?
Yes you can to an extent.
First the ground rules:
You can't modify the product from the front-end and update the content or media in the back-end - this would be a huge security hole
The changes applied to the product will be visible only to the user who changed them
The solution is to use Javascript and update the content of the front-end. If you like to store the changes for that specific user you can save them as cookie or localstorage.
If you like to share this change to other people you will need to add a custom parameter in the URL of the page and generate the content from it and share that url.
Each one of these steps will require some custom Javascript that will affect only the user in question, if you like to modify the product in the back-end directly you will need some kind of an app for this.
On my mind it can be done if the dynamic text is applied over product image.
Detailed code would be too long to write here but here are the steps:
Add an input to your product form to add a custom property (https://community.shopify.com/c/Shopify-Design/Product-pages-Get-customization-information-for-products/td-p/616503)
Write a Javascript function to get input value in real time
Use this value to display it in a div in product image container
Position this div in CSS as absolute and style it as you wish
While image container position should be set as relative in CSS
HTH

Is there is anyway to update the text-input in react-native

I am using text input in react-native,now my requirement is that i want to update my Text-Input at same time while user type something like "Hello" and get altered in some other language and set over there.How can i set my new text on text-input while at typing?
dynamically translating letters, i dont think makes sense as even if you use an API or some node module for translation how would it get to know what the user is going to end with typing, there is no letter to letter mapping possible untill you donot want it to make sense explicitly.
do you get what i am trying to say?

How to change dojo locale after dojo loaded?

We need set locale in data-dojo-config before dojo loaded so that dojo.i18n will work with this locale. Is there any workaround that we can change this locale in dojo/_base/config after dojo loaded so that any further dojo.i18n call will work with this new locale?
I have a single page application, by carefully design, I already be able to recreate all my UI widgets dynamically anytime. I want to add a Select somewhere so that user can change languages on the fly. Currently the only solution I have is put a queryString locale='newLocale' at Url and force browser refresh. That works but everything User have done lost and with a fresh start. That's not what I want.
Any idea? I don't afraid some changes of dojo to make this happen since my application will be built as a single layer and deploy to customers.
According to dojo's documentation, you cannot change the locale once it's loaded. See this page from their documentation, the relevant line is:
Once Dojo is loaded, it is not possible to change the locale for the
page.
Your description of adding a new parameter is what I've done in this situation, you can specify the locale property on the dojoConfig object to override the default locale.
EDIT: There is an open bug for this use case, see https://bugs.dojotoolkit.org/ticket/17196. In that ticket there also appears to be a workaround that basically involves manually loading the resource file of the language you want to use and updating any text.
So, adapting their example (http://jsbin.com/aquviq/1/edit), this would run after you initiate a change locale action:
require(['dojo/i18n!dojo/nls/' + resourceModuleWithLocale], function (resource) {
/* in here, you must set all of the text manually to the values in the resource object */
});
It still seems like a lot of work, but I suppose that's one possible way to accomplish this.