Language Setting unexpectedly affects date format

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Post Reply
User avatar
jeffbronks
Posts: 214
Joined: Fri Mar 04, 2005 12:39 pm
Location: Cambridgeshire, UK

Language Setting unexpectedly affects date format

Unread post by jeffbronks »

In H&M 6 and previous versions, I used to follow the advice in the H&M manual regarding the "Language Settings > Language of help file" setting:
The default setting is English (United States). This should not be changed for English and Western European languages unless you experience problems with sorting in the Keyword Index.
In H&M 7, the language setting seems to have expanded its influence and now affects the format of the <%DATE%> variable. If you set it to English (US) you get MM/DD/YYYY date format, and English (UK) gives you DD/MM/YYYY format. I don't know what controlled the date format in H&M 6 - perhaps the Windows locale - but it didn't depend on the language setting and I got the desired UK format on my UK Windows installation.

This change means that in H&M7, in order to get the <%DATE%> variable to work in the UK, you have to disobey the language setting advice in the manual. It hasn't caused me a problem yet, but I am afraid that my next CHM might fail because the H&M 7 manual also says:
Because of a bug in the Microsoft HTML Help viewer it is best to set English (United States) for all Western European languages if possible.
So, is this a bug in H&M 7?
User avatar
waldemar.hersacher
Posts: 456
Joined: Tue Dec 09, 2003 10:06 pm
Location: Near Stuttgart Germany
Contact:

Re: Language Setting unexpectedly affects date format

Unread post by waldemar.hersacher »

This was also dicussed here.

On one side I think it is a good change. Why? I have a German Windows with regional settings set to German (Germany).
My projects are multilingual so I have the timestamp formated as it is used normally in the country.

On the other side it is not a good idea to have no chance to force a format. I will have only an English manual regardless of BE or AE. But if you are looking on the formats they are different. For 04/03/2015 you can't say it is 4th of March (UK) or 3rd of April (US). I prefer for any language to have the date format according to ISO 8601. And this format is accepted in a lot of countries even in US and UK.
I don't know what controlled the date format in H&M 6 - perhaps the Windows locale
I made a test. In H&M6 it is the short date format of the regional settings.

I didn't mind about that before because I had only German customers. Multilingual projects are comming up now with my new employment.
Waldemar
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Language Setting unexpectedly affects date format

Unread post by Tim Green »

In HM6 the formats of the the time and date variables were drawn from your Windows region settings. In HM7 it is currently based on the language of your project. We may provide some added flexibility for this in future updates... :)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Kerstin Thaler
Posts: 17
Joined: Tue Jan 10, 2012 1:47 pm

Re: Language Setting unexpectedly affects date format

Unread post by Kerstin Thaler »

Tim Green wrote:In HM6 the formats of the the time and date variables were drawn from your Windows region settings. In HM7 it is currently based on the language of your project. We may provide some added flexibility for this in future updates... :)
+1 for free date formatting
Best regards
Kerstin

Windows 10 64bit
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Language Setting unexpectedly affects date format

Unread post by Martin Wynne »

Kerstin Thaler wrote:+1 for free date formatting
Hi Kerstin,

If you use the <%NOW%> variable instead of <%DATE%> you have full control of the formatting.

For example <%NOW(d-mmm-yyyy)%>

will output as 10-Aug-2015 which should be understood on both sides of the pond.

Full details of all the formatting options are here: http://help.ec-software.com/index.html? ... _dates.htm

p.s. If you want to go further, you could use the .PHP option for your topic files. Then using the PHP date(); function in an HTML Code Object you could output strings such as "This topic was last updated 23 days ago". More about that here: http://www.w3schools.com/php/func_date_date.asp

Martin.
Kerstin Thaler
Posts: 17
Joined: Tue Jan 10, 2012 1:47 pm

Re: Language Setting unexpectedly affects date format

Unread post by Kerstin Thaler »

Hi Martin,

thank you very much for these valuable information. Basically, nothing more is needed.

Still, I don't think changing how the <%date%> variable is fed wasn't such a good idea since it can "break" existing documents.
Best regards
Kerstin

Windows 10 64bit
VincentBevort
Posts: 90
Joined: Wed Mar 30, 2016 1:53 pm
Location: Stockholm, Sweden
Contact:

Re: Language Setting unexpectedly affects date format

Unread post by VincentBevort »

Hi,

Have a simular problem working on a Swedish PC in a company that has English as Company language but we use an international format

<%NOW(yyyy-mm-dd)%> gives 2016-05-25

Work great
Senior Test Engineer & Technical Writer
Flowbird group
Andie Davidson
Posts: 17
Joined: Wed Apr 05, 2017 9:38 am

Re: Language Setting unexpectedly affects date format

Unread post by Andie Davidson »

Accepting that we might all adopt ISO 8601, in reality we don't, so only having the short date form for <%TOPICLASTEDITED%> etc. isn't good enough for UK/US spanning organisations.
I would like to carry a last edited stamp to show on each topics - not the current date (<%NOW%>) every time an edit of any topic results in republishing the whole document.
OK, I could just type the date in "21 Feb 2018" at the bottom of every topic page, conditional to exclude in PDFs, but there are benefits of using variables in skins ...
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Language Setting unexpectedly affects date format

Unread post by Tim Green »

Andie,

You can include specific formatting for each use of the <%NOW%> variable in a format string. See here:

https://helpandmanual.com/help/index.ht ... _dates.htm

If you need two versions for different versions of your project you can achieve this by inserting two versions of the variable with format strings and including your own build conditions in the project. Then in topics you can use the conditional text tool with your conditions, e.g. [IF BRIT]uk version[END][IF USA]usa version[END]. In HTML templates the conditions can be written like this:

Code: Select all

<IF_BRIT>uk version</IF_BRIT><IF_USA>usa version</IF_USA>
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Andie Davidson
Posts: 17
Joined: Wed Apr 05, 2017 9:38 am

Re: Language Setting unexpectedly affects date format

Unread post by Andie Davidson »

OK; thanks for this. Can I clarify how this works?

<%NOW%> in the project HTML Default template:
will this generate the date the project was last published to webhelp, or the date the topic was last changed (the xml file date)?

<IF_[lang]> detects the end-user's (reader's) computer language settings (not the language setting in the H+M project)?
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Language Setting unexpectedly affects date format

Unread post by Tim Green »

Andie Davidson wrote:<%NOW%> in the project HTML Default template:
will this generate the date the project was last published to webhelp, or the date the topic was last changed (the xml file date)?
<IF_[lang]> detects the end-user's (reader's) computer language settings (not the language setting in the H+M project)?
The <%NOW%> variable always returns the date and time at which it was processed, i.e. the publication date and time. There is no <IF_[lang]> condition, sorry. I'm afraid that's wishful thinking on your part.. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Andie Davidson
Posts: 17
Joined: Wed Apr 05, 2017 9:38 am

Re: Language Setting unexpectedly affects date format

Unread post by Andie Davidson »

Ah! So there is no variable reflecting the xml timestamp. And I confused by generalising <IF_[lang]> for your <IF_BRIT> and <IF_USA> alternatives.

So is <IF_BRIT> valid, and would this display the date according to a UK/EU browser's local PC? And similarly <IF_USA> would respond to a USA reader's local PC settings?

Yes, I was hoping for a tag for the default template that picked up the xml file timestamp rather than the publication/processing timestamp.

So, when placed within the topic, is <%TOPICLASTEDITED%> the xml timestamp? (but non-configurable like <%NOW%>)?

I was just looking for the easiest way to reflect the edit date for every topic, in a format suitable for US and UK/EU readers. (Preferably without having to manually revisit every topic in every project and republish everything, now I have maybe 1000 of them!)
VincentBevort
Posts: 90
Joined: Wed Mar 30, 2016 1:53 pm
Location: Stockholm, Sweden
Contact:

Re: Language Setting unexpectedly affects date format

Unread post by VincentBevort »

The <IF> statement uses Builds as flags
There is no if_brit or if_USA.

You must create 3 builds:
  • BRIT
  • USA
  • EU
Than you have to write the following line in each of your topics

Code: Select all

<IF BRIT>date in British format</ENDIF]<IF USA>date in USAformat</ENDIF]<IF EU>date in EU format</ENDIF]
Note: the differenct between the British and EU format is the divider sign. The EU format uses 2018-02-28 or 28-02-2018 depending on the country.

Then when publishing you select the build you want.
Senior Test Engineer & Technical Writer
Flowbird group
Andie Davidson
Posts: 17
Joined: Wed Apr 05, 2017 9:38 am

Re: Language Setting unexpectedly affects date format

Unread post by Andie Davidson »

Thank you. I understand that now - I didn't realise that these were build designators. I don't, however, want to build everything three times, especially since it seems I can't find a variable for the xml topic file timestamp that operates in the default template.

<%TOPICLASTEDITED%> is clearly what I need, which takes me back to the start: it can't be formatted for the receiver to be unambiguous i.e. dd-MON-yyyy.
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Language Setting unexpectedly affects date format

Unread post by Tim Green »

Hi Andie,

Vincent answered your other questions perfectly. Sorry I wasn't so clear on the IF_lang things --it was a while since I was last on this thread and I had forgotten about that part... :roll:
Andie Davidson wrote:<%TOPICLASTEDITED%> is clearly what I need, which takes me back to the start: it can't be formatted for the receiver to be unambiguous i.e. dd-MON-yyyy.
Unfortunately, no. The NOW variable is the only one that supports the formatting string. I suggest you add a feature request to the Wish List section. That is monitored by our developers, and the more people who chime in and say "me too" the more chance it has of getting implemented. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Post Reply