Insert date in different languages

Hello

This is a question about switching between English and French. I live in France and am quite fluent in French but I prefer to write in English if I can. My Mac preferences are set to 1. English 2. French.

I'm relatively new to Pages and I'm trying to set up letter templates in both English and French. For the latter I have selected all and specified Français in the Inspector Pane. This looks as if it will work, except it has no effect on the date, which I have put in using Insert Date and Time.

Is there a way to do this which I have not spotted in the User Manual, or will I have to resort to entering the date manually as text in every letter?

Thanks for any suggestions

iMac G5, Mac OS X (10.6.2)

Posted on Jan 8, 2010 3:42 AM

Reply
15 replies

Jan 8, 2010 5:59 AM in response to fruhulda

Switching languages in System Preferences (and rebooting Pages let alone the System is overkill if it is just to insert today's date. After all, I can use the French spell checker for the rest of the document simply by selecting Francais in the Inspector Pane.

There is the added complication that switching the Preferences language also changes the input keyboard. I have a French keyboard for friends, but as a touch typist I want to stay with my trusty international English keyboard. Othzrzise I cqn eqsily produce q loqd of nonsence:

I just wish that Apple could lead the way by distinguishing between:
- location
- language of choice
- keyboard

Surely I cannot be the only person residing in a non-anglophone country, wanting to write in two languages, with an English keyboard (and retaining my menus in English)?

Jan 8, 2010 6:19 AM in response to FRA_ALLEN

You have to tell Pages somehow what language to use.

It gets pretty confusing if you have English selected as your application language but you want some English and some French inserted automatically. What is Pages to do?

The simplest solution is to simply replace the day/month name. Everything else is just date order which you can set separately in your International Preferences.

I use the Japanese/ISO date order with my Australian keyboard as it simply makes sense.

Peter

Jan 8, 2010 7:07 AM in response to PeterBreis0807

I use the Japanese/ISO date order with my Australian keyboard as it simply makes sense.

Not to me it doesn't Pete (haven't a clue what Japanese/ISO date order means), but thanks for making me think of other workarounds.

In the end I will leave Insert Date in the template and then edit it to make it numeric only. Less elegant than words, but less work.

Yes, fruhulda, I can touch type, but I'm lazy... ...

I still think there are some interesting issues about the relationship between location/language/keyboard to be addressed.

Jan 8, 2010 7:39 AM in response to FRA_ALLEN

Japanese/International Standards Organisation sets the date in descending order

ie Year/Month/Day

Which makes perfect sense as it reads left to right and is the same order as numbers and therefore sorts correctly without any silly work arounds. Its structure is obvious at one glance

The worst format of all is the USA Month/Day/Year order which makes no sense and is ambiguous when the month and day numbers are less than 13.

Peter

Jan 8, 2010 9:15 AM in response to FRA_ALLEN

Your problem is easy to solve.
One year ago, I posted a script able to insert the date in French on a system using an other language (it does that also on a Frernch system but it's not really useful).

Here it is :

--

--[SCRIPT dateEnFrancais.app]
(*
Enregistrer le script en tant que Script, Application ou Progiciel : dateEnFrancais.xxx
déplacer l'application créée dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Pages:
Il vous faudra peut-être créer le dossier Pages et peut-être même le dossier Applications.
Placez le curseur à votre guise
menu Scripts > Pages > dateEnFrancais
Le script insérera la date à l'emplacement du curseur.
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
-- NOUVEAU NOUVEAU NOUVEAU
Grace au programme gratuit ThisService, il est possible d'encapsuler ce script dans un service.
Télécharger ThisService depuis:
http://wafflesoftware.net/thisservice/
Lors de la création du service, cliquer le bouton "Produce output".
Il est possible d'associer un raccourci clavier au service.
+++++++
Save the script as a Script, an Application or an Application Bundle: dateEnFrancais.xxx
Move the newly created application into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Pages:
Maybe you would have to create the folder Pages and even the folder Applications by yourself.
Now, enter your Pages document and put the cursor where you want to insert the date.
menu Scripts > Pages > dateEnFrancais
The script will insert the date in the Pages document.
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
-- NEW NEW NEW NEW
Thanks to the free program ThisService, we may encapsulate this script in a Service.
Download ThisService from
http://wafflesoftware.net/thisservice/
When creating the service click the button "Produce output"
We may link the service to a shortcut.
+++++++
Yvan KOENIG (Vallauris FRANCE)
8 février 2009
10 février 2009
*)
property avecNomJour : true
--=====
on run {}
set rezult to my main()
tell application "Pages" to tell document 1 to set selection to rezult
end run
--=====
on process()
set rezult to my main()
return rezult
end process
--=====
on main()
local francais, w, dd
set dd to current date
set francais to "" & (day of dd) & space & item (month of dd as number) of {"janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"} & space & year of dd

if avecNomJour then
set w to (weekday of dd) as text
set w to text 1 thru 3 of w

repeat with j from 1 to 7
if w = item j of {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"} then
set w to item j of {"lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi", "dimanche"}
exit repeat
end if
end repeat
set francais to w & space & francais
end if
return francais
end main
--=====
--[/SCRIPT]
--


Yvan KOENIG (VALLAURIS, France) vendredi 8 janvier 2010 18:15:17

Jan 8, 2010 12:13 PM in response to FRA_ALLEN

Thanks, Peter, for clarification on Japanese/ISO date order. I totally agree: I so much prefer year/month/day to the illogical month/day/year, and even to our day/month/year. ( Indeed this is how I rename all my photos, to get them into chronological order.) I'm playing round with the System Preferences to do this (though, incidentally, the old style Fri 8 Jan still appears in my menubar).

Thanks, Yvan for the offer of the script. I've hardly ever used applescript and will need to read some documentation before trying it out. Just at the moment I cannot get it to appear in a new Pages document. And anyhow, my priority this evening, has to be finishing my mildly complaining letter to France Telecom Orange (who else???).

Jan 9, 2010 2:30 AM in response to FRA_ALLEN

It would be useful to read carefully the given explanations.

I wrote :

Save the script as a Script, an Application or an Application Bundle: dateEnFrancais.xxx

+It's an old beast. On new ones I restrict the list of formats to the first one : save as script which proves to be the most efficient.+
Move the newly created application into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Pages:
Maybe you would have to create the folder Pages and even the folder Applications by yourself.

Now, enter your Pages document and put the cursor where you want to insert the date.

menu Scripts > Pages > dateEnFrancais

+As you may check, I never wrote about the *Pages menu* but about the Pages menu (item) in the menu 'Scripts'.+
The script will insert the date in the Pages document.

--=====

The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.


User uploaded file

Yvan KOENIG (VALLAURIS, France) samedi 9 janvier 2010 11:29:51

Jan 9, 2010 4:27 AM in response to FRA_ALLEN

Ivan

I have now successfully run your applescript and I have saved the result in a Pages template. I will know tomorrow if when I use the template it changes the date.

If this works I will be able to have a French version of my letter template including date. At any rate your messages have fired me up to learn a little more about applescript!

Merci pour votre aide

Jan 9, 2010 7:38 AM in response to FRA_ALLEN

(1) my first name is not Ivan but Yvan to which I am acustomed since 1943/12/31 😉

(2) The posted script is inserting a fixed string, not a living date.
There is no way to have two living localized formats.

To mimic that,you may use an other kind of script.
The idea behind it is:
create a custom template with a string marking the location of the wanted date *fakeDate* for instance.
When you want to create a document of this kind, launch the other kind_ofscript.
It will create a new document from the custom template and replace the marker *fakeDate* by the French Date.

If I have free time, I will write such a script assuming that the custom template is stored in the standard dedicated folder.

Yvan KOENIG (VALLAURIS, France) samedi 9 janvier 2010 16:38:41

Jan 9, 2010 10:00 AM in response to KOENIG Yvan

Here is the announced script.

I dropped the enclosing asterisks so I may search more easily the location of the inserted date.

--

--[SCRIPT openAndInsertFrenchDate]
(*
Enregistrer le script en tant que Script : openAndInsertFrenchDate.scpt
déplacer le fichier créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Pages:
Il vous faudra peut-être créer le dossier Pages et peut-être même le dossier Applications.
menu Scripts > Pages > openAndInsertFrenchDate
crée un nouveau document à partir du modèle personnel prédéfini
et remplace les mots "mytFakeDate" par la date en Français.
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
+++++++
Save the script as Script, Application or Application Bundle: openAndInsertFrenchDate.xxx
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Pages:
Maybe you would have to create the folder Pages and even the folder Applications by yourself.
menu Scripts > Pages > openAndInsertFrenchDate
will create a new document from the defined user template
and replace every words "myFakeDate" by the date in French.
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
--=====
Yvan KOENIG (VALLAURIS, France)
2010/01/09
*)
property theApp : "Pages"
property theMonths : {"janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"}
property theDays : {"lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi", "dimanche"}
property balise : "myFakeDate" (* CAUTION? You may change it but, it MUST be a word *)
property avecNomJour : true
(*
true : inserts the name of the day before the date
false : doesn't insert the name of the day before the date
*)
--=====
on run

set p2myTemplate to my prepare()
set FrenchDate to my dateEnFrancais()
set UNTITLED_loc to my getLocalizedFrameWorksName(theApp, "Untitled")

tell application theApp
activate
try
close document UNTITLED_loc
end try
end tell -- theApp

tell application theApp
activate
open p2myTemplate
tell document 1
set n to count of words
repeat with P from n to 1 by -1
if word P is balise then set word P to FrenchDate
end repeat
end tell -- document
end tell -- theApp
end run
--=====
on dateEnFrancais()
local dd, francais, w, j
set dd to current date
set francais to "" & (day of dd) & space & item (month of dd as number) of theMonths & space & year of dd

if avecNomJour then
set w to (weekday of dd) as text
set w to text 1 thru 3 of w

repeat with j from 1 to 7
if w = item j of {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"} then
set w to item j of theDays
exit repeat
end if -- w = item j…
end repeat
set francais to w & space & francais
end if -- avecNomJour
return francais
end dateEnFrancais
--=====
on getLocalizedFrameWorksName(theApp, x)
local p2bndl
set p2bndl to (path to application support as text) & "iWork '09:Frameworks:SFApplication.framework:Versions:A:Resources:"
return my getLocalizedName(theApp, x, p2bndl)
end getLocalizedFrameWorksName
--=====
on getLocalizedName(aa, tt, ff)
tell application aa to return localized string tt from table "Localizable" in bundle file ff
end getLocalizedName
--=====
on prepare()
local d1, d2, customTemplateFolder
tell application theApp
set d1 to localized string "Templates" (* nom local du dossier "Modèles" *)
set d2 to localized string "My Templates" (* nom local du dossier "Mes Modèles" *)
end tell -- theApp
set customTemplateFolder to (((path to application support from user domain) as Unicode text) & "iWork:" & theApp & ":" & d1 & ":" & d2 & ":") as alias
return choose file default location customTemplateFolder without invisibles

end prepare
--=====
--[/SCRIPT]
--


Yvan KOENIG (VALLAURIS, France) samedi 9 janvier 2010 18:59:40

Jan 12, 2010 11:50 AM in response to KOENIG Yvan

Hello

I was not satisfied by the scheme used to find the location of the 'balise' to replace by the French date.

Here is a new version using an other schem allowing us to use a safer balise.

--

--[SCRIPT openAndInsertFrenchDate]
(*
Enregistrer le script en tant que Script : openAndInsertFrenchDate.scpt
déplacer le fichier créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Pages:
Il vous faudra peut-être créer le dossier Pages et peut-être même le dossier Applications.
menu Scripts > Pages > openAndInsertFrenchDate
crée un nouveau document à partir du modèle personnel prédéfini
et remplace toutes les occurences de la chaîne "#FakeDate_etaDekaF#" par la date en Français.
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
+++++++
Save the script as Script, Application or Application Bundle: openAndInsertFrenchDate.xxx
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Pages:
Maybe you would have to create the folder Pages and even the folder Applications by yourself.
menu Scripts > Pages > openAndInsertFrenchDate
will create a new document from the defined user template
and replace every strings "#FakeDate_etaDekaF#" by the date in French.
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
--=====
Yvan KOENIG (VALLAURIS, France)
2010/01/09
2010/01/12 : nouveau mode de recherche de la balise
*)
property theApp : "Pages"
property theMonths : {"janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"}
property theDays : {"lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi", "dimanche"}
property balise : "#FakeDate_etaDekaF#"
property avecNomJour : true
(*
true : inserts the name of the day before the date
false : doesn't insert the name of the day before the date
*)
--=====
on run

set FrenchDate to my dateEnFrancais()
set UNTITLED_loc to my getLocalizedFrameWorksName(theApp, "Untitled")
set p2myTemplate to choose file default location my getTemplatesFolder() without invisibles

tell application "Pages"
activate
try
close document UNTITLED_loc
end try

open p2myTemplate

tell document 1
repeat
set tt to item 1 of every text
if tt does not contain balise then exit repeat
set i1 to offset of balise in tt
select text from character i1 to character (i1 + (length of balise) - 1) of body text
set the selection to FrenchDate
end repeat
end tell -- document
end tell -- Pages
end run
--=====
on dateEnFrancais()
local dd, francais, w, j
set dd to current date
set francais to "" & (day of dd) & space & item (month of dd as number) of theMonths & space & year of dd

if avecNomJour then
set w to (weekday of dd) as text
set w to text 1 thru 3 of w

repeat with j from 1 to 7
if w = item j of {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"} then
set w to item j of theDays
exit repeat
end if -- w = item j…
end repeat
set francais to w & space & francais
end if -- avecNomJour
return francais
end dateEnFrancais
--=====
on getLocalizedFrameWorksName(theApp, x)
local p2bndl
set p2bndl to (path to application support as text) & "iWork '09:Frameworks:SFApplication.framework:Versions:A:Resources:"
return my getLocalizedName(theApp, x, p2bndl)
end getLocalizedFrameWorksName
--=====
on getLocalizedName(aa, tt, ff)
tell application aa to return localized string tt from table "Localizable" in bundle file ff
end getLocalizedName
--=====
on getTemplatesFolder()
local d1, d2

tell application theApp
set d1 to localized string "Templates" (* nom local du dossier "Modèles" *)
set d2 to localized string "My Templates" (* nom local du dossier "Mes Modèles" *)
end tell -- theApp
return (((path to application support from user domain) as Unicode text) & "iWork:" & theApp & ":" & d1 & ":" & d2 & ":") as alias

end getTemplatesFolder
--=====
--[/SCRIPT]
--


Yvan KOENIG (VALLAURIS, France) mardi 12 janvier 2010 20:50:11

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Insert date in different languages

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.