How can set currency after price in hybris? - currency

I want to show the prices as 45.99 Kč
It is showing as Kč 45.99.
I tried formatters.impex
INSERT_UPDATE PriceFormatter;owner(CountryConfiguration.code)[unique=true];patternPositives[lang=cs_CZ];patternNegatives[lang=cs_CZ];decimalSeparator[lang=cs_CZ];groupingSeparator[lang=cs_CZ];currencySymbol;
;CZ;#{groupingSeparator}##0{decimalSeparator}00 {currencySymbol};- #{groupingSeparator}##0{decimalSeparator}00 {currencySymbol};,;space;Kč;

I can't find PriceFormatter in version 2005.Can it be custom type which is developed by your team?
Currency position information coming from localization. You can check DefaultPriceDataFactory class. It is determine current locale with CommerceCommonI18NService and I18NService then determine format in createCurrencyFormat method.
I am not sure CZ currency format but you can check it in your/server NumberFormat localization. If your java localization not mach your need, you can change it.
Another way is editing price.tag file for frontend to change using price and currency instead of formattedPrice.

Related

Locale setting of importxml function in google sheet not working

I'm trying to extract prices from bookdepositary site in local currency. However, it always retrieves the USD prices no matter what I am trying.
A specific example is:
=IMPORTXML("https://www.bookdepository.com/1/9783836519885";"//span[#class='sale-price']";"bg-BG")
gives US$47.63 no matter that Google sheet settings are changed to Bulgarian and despite of the locale set to "bg-BG".
The same US$47.63 result is retrieved when I use another scrap method like:
=IMPORTXML("https://www.bookdepository.com/1/9783836519885";"//meta[#itemprop='price']/#content";"bg-BG")
The following does not retrieve any result (but this is a secondary problem I am investigating which will follow once I understand the locale problem):
=IMPORTXML("https://www.bookdepository.com/1/9783836519885";"/html/body/div[2]/div[6]/div[3]/div/div[1]/div[1]/div[3]/div/div[2]/div/div[3]/div/span[1]";"bg-BG")
What do you think - is there a workaround?
I don't think that can be done with importXML().
The function help page seems to be missing the locale parameter, but the formula editor inline help box tells the following:
locale: A language and region locale code to use when parsing the data. If unspecified, the document locale will be used.
The importXML() function only finds data that actually appears in the XML document. The endpoint you mention seems to adjust its content per the client's IP address, but in each response, it only has prices in one currency.
The locale parameter does not change the IP address the request is sent from. It gets sent from one of Google's servers, most of which are in the United States. When you set the locale parameter, the content may get parsed in a different way, but that will not magically make additional content appear in the page.
in this case, what you actually need is to fool google sheet to not default out on the "common path"
you need something like: https://www.4everproxy.com/ (but with Bulgarian support)
here is some example...
where:
and then the formula will be from:
=IMPORTXML("https://de.4everproxy.com/direct/aHR0cHM6Ly93d3cuYm9va2RlcG9zaXRvcnkuY29tLzEvOTc4MzgzNjUxOTg4NQ--","//span[#class='sale-price']")

Change default language for TFS 2018

I have an installation of Team Foundation Server 2018. The problem is the web interface defaults to English (United States). I need to change this to English (Canada) as the default but this is not in the Language drop down.
The Windows Server is set to use English (Canada) so I need to know how to update TFS. The main reason I need this is that the US write their dates backwards and this causes all sort of issues with work tracking as people assume the date is the correct way around and we end up with tasks due on the 11th of January when they should be for the 1st of November.
I know one possible work around would be for everyone to set their language specifically to English (United States) and then change the default date pattern so the date is correct, but this is not satisfactory as it involves work on the part of hundreds of users.
The best way to solve this is to configure Windows to send the primary browser locale as 'en-CA', this can be done through an Active Directory Policy, with TFS configured to use "Browser" as locale it should default to the correct date format for that locale.
(See the locale switching to "Nederlands (Nederland)" which is my locale)
If users are using a different browser, they may have to configure that as well, for example, my Chrome configuration:
Alternatively, you can set the language for each users in the TFS Configuration Database for individual users. It can be overridden there in bulk.
THIS IS NOT SUPPORTED AND MAY LEAVE YOU IN A BROKEN STATE
update [Tfs_Configuration].[dbo].[tbl_RegistryItems]
set
[RegValue] = 'dd-MM-yyyy'
where
ParentPath LIKE '#\Users\%\UserPreferences\'
and ChildItem = 'DatePattern\'
insert into [Tfs_Configuration].[dbo].[tbl_RegistryItems]
(PartitionId, ParentPath, ChildItem, RegValue)
select
1 as PartitionId,
'#\Users\' + lower(convert(nvarchar(36), tbl_Identity.Id)) + '\UserPreferences\' as ParentPath,
'DatePattern\' as ChildItem,
'dd-MM-yyyy' as RegItem
from tbl_Identity
where
IsGroup = 0
and Domain = 'AzureAD'
and not exists
(
select 1 from [Tfs_Configuration].[dbo].[tbl_RegistryItems]
where ParentPath = '#\Users\' + lower(convert(nvarchar(36), tbl_Identity.Id)) + '\UserPreferences\'
and ChildItem = 'DatePattern\'
)
Sorry, the language settings in locale -> user profile do not include all language option such as English (Canada).
According to your description, you could simply change Date pattern under the preferred language which basically contains all the options,
For example, select d-MM-yy, then 1st of November should be 01/11/2018.

Grails: How to format date in language set in locale?

My multi-language Grails-based website has a switch for locale. I'd like to make sure date values are displayed in the locale set (and in the format currently being used in other outputs of scaffolding as the site is already available to the customer).
Here's an example code I'm using:
<g:formatDate date="${eventInstance?.date}"/>
The solution I came up with following this entry from the manual is:
<g:formatDate date="${eventInstance?.date}" formatName="default.date.format.short" />
and in my i18n/*.properties files settings for default.date.format.short (the global standard, default.date.format, was already set to another format).

iOS NSString - Creating upper case based on locale

My iOS application has language selection option.
Its a server based application that receives all the strings from server that are to be displayed in the app.
In one of the view, i've to convert text to "upper case", for that I'm using NSString's upperCaseString method. This is working good for English. But for other languages like French, Chinese, Russian, German etc, it might create problem. So, I've to use "uppercaseStringWithLocale" to provider appropriate upper case string.
My question is how to create the NSLocate and pass it to "upperCaseStringWithLocale" method based on the language name. I know what's the language of the app that user has selected. Can I create locale object based on language name.?
I think you are looking for:
NSString *theLocaleIdentifier = #"es_ES_PREEURO";
[[NSLocale alloc] initWithLocaleIdentifier:theLocaleIdentifier];

Handling different date formats in ROR

I am trying to build a ROR app that allows users to enter date in various formats such as 12/31/11 (month/day/year) or 31/12/11 (day/month/year). In order to interpret date format, I will have a select field from where user can select the format of date. I can use Date.strptime(value, format).to_s() in controller before saving record.
However, I am not sure is controller right place to put this information. Is there a way I can push this to model..say in before save method.
You could just save the data as it is (in the controller), and have another field in the model telling it how to interpret the data. Then, in a before_validation callback, you could try parsing the date according to the given format and writing it to the same field, now as a date. Problems may arise on the way back. Then, to display it in the view again, you could write helpers - but better yet, provide a method in the model (for instance, formatted_date) that will compute and display the date.
However, this requirement sounds strange. Why is the user's responsibility to select a date format? Shouldn't it be based on the user locale?
In any case, I suggest you register your date formats in an initializer, rather than repeting the format strings throughout the application.

Resources