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).
Related
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']")
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.
I am trying to allow MM/dd/YYYY or M/d/YYYY.
Or this pattern:
02/04/1998
02/4/1998
2/04/1998
2/4/1998
Seems that the issue has been fixed with this commit. You can now define a day/month/year-date in format d!.M!.yyyy. It allows an optional leading zero for day and month. See this github-issue for more information.
Available as NPM (angular-ui-bootstrap) from V1.0.
Per the Angular UI Bootstrap datepicker documentation, the directive uses the date filter built into angular core (documentation here).
Based on the formatting you desire, you want MM for format-month attribute and dd for the format-day attribute.
I have several datetime_field in my application. By default, they are displaying the date as the rails format, as I dictated that for my bootstrap-datepicker:
format: 'YYYY-MM-DD HH:mm:ss'
The issue: I want the date on the views to display in a different format, say:
'MM-DD-YYYY HH:mm:ss'
I've been scratching my head for a while on this one. Every change I make to the view side, be it by Javascript, jQuery, rails methods, helpers, whatever - they all affect the submit data, which then becomes invalid, because Rails expects the first format.
I don't want to change the default date format - we have other aspects of the website that need the database in the normal rails format. I just want to change the display of the date in the datetime_field, without changing the submitted date.
My guess would be it was an option in the datetime_field, but I can't seem to find one:
<%= f.datetime_field(:end_date, {?????})%>
Any suggestions on how to accomplish this?
I am developing one MVC4 application, in that there is option for language seletion in my application & based on that selected lanaguage, all label & messages are displayed.In this application i have put one required field validation of MVC, and it will display validation message in english only.I have created two different xml file for Localization in my application folder i.e Resource.resx for english lanaguage & Resource.de-DE.resx for German langauge. I have used the following code in my Model class :
[Required(ErrorMessageResourceType = (typeof(MyFolder.MyResource.Resource)), ErrorMessageResourceName= "FromDateRequiredMessage")]
[Display(Name = "FromDate", ResourceType = typeof(MyFolder.MyResource.Resource))]
public DateTime FromDate { get; set; }
So here i have Resource.resx xml file and in that i have Key is 'FromDateRequiredMessage' which is same key as in Resource.de-DE.resx german file but different value.Also i have make the follwing changes in my in web.config file for globalization :
<globalization enableClientBasedCulture="true" culture="auto" uiCulture="auto"/>
So, i want that when i select the german language from my application, then it should show me validation error in german language.But here it will show me validation message in english only.
So, now what can i do for this? Please hel me.
Please use method Application_PreRequestHandlerExecute() in your application's Global.asax file. This method will execute before any page request or its validation.
Also set the current culture value in this method.
Simple answer > nothing is wrong!
when you put culture=auto in web.config it works this way, your application will look at the header of the incoming request and look for accept languages and the order of them, so in one request in it you have something like En - Fa ... the application will select the first one and set culture an ui culture to that, so go to your browser language settings and change the order of the languages to test your application.
In order to be able to do this you will need to set the culture. So will provide the user with selection in dropdown etc which they explicity select German,English etc, this will change yoursite to be yoursite/En or yoursight/Gr etc. This article explains in well and gives sample code. http://www.codeproject.com/Articles/207602/Creating-a-Bilingual-ASP-NET-MVC3-Application-Part the part "Adding UI support to switch languages" has what you need i believe.