Matching months as words in foreign languages

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

Because it took me some time digging through this forum, I thought I'd share the knowledge here. This applies to Hazel 4.0.2, but probably also to version 3.x.
Just to be complete: this is tested on El Capitan, 10.11.5.

I prefer to have my operating system in English, while my native language is Dutch. So I process a lot of Dutch documents with Dutch dates.

Problem 1: you want to match a date in a file where the month is written in words AND is in a different language than English. E.g.

EN: 12 March 2016
NL: 12 maart 2016

You can still match the date with a Custom Date variable where you choose the month name written in full in English (December). So in this case you would match with [day: 2 positions] [month: December] [year: 4 digits]

To allow Hazel to match the Dutch version, you need to add Dutch as a preferred language in System Preferences > Language & Region > Preferred Languages.

You can then use the date variable in e.g. the name of the file in any pattern you'd like.

Problem 2: you matched a date in a file and want to use it with the month in letters in a different language than English. E.g. you want to match 2016-03-05 and use it as 2016-maa-05 (in Dutch).

To allow Hazel to use the Dutch version of the month names, you need to set Dutch as the format language in System Preferences > Language & Region > Advanced > General > Format language.
hepabolu
 
Posts: 16
Joined: Sat Aug 11, 2012 10:47 am

Many thanks, just had to solve exactly this problem. Your post saved me a lot of time and grief.
Dave61
 
Posts: 113
Joined: Tue Jul 10, 2012 4:56 pm

Thanks, on Monterey the language option is a bit different, there is no Format Language.

Anyway, why does Hazel turn "23 mrt 2021" turn in to September? While it should be March (mrt = dutch abbreviation for March).

I am unable to solve it using System Preferences, I already have Dutch as a second language there (English being the main system language).

Thanks,
Etienne
etienne74
 
Posts: 7
Joined: Tue Dec 24, 2019 9:14 am

If English is the first language, then that takes precedence. If you want things formatted in Dutch, you will need to put that before English in the list.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

hepabolu wrote:
Problem 1: you want to match a date in a file where the month is written in words AND is in a different language than English. E.g.

EN: 12 March 2016
NL: 12 maart 2016

You can still match the date with a Custom Date variable where you choose the month name written in full in English (December). So in this case you would match with [day: 2 positions] [month: December] [year: 4 digits]

To allow Hazel to match the Dutch version, you need to add Dutch as a preferred language in System Preferences > Language & Region > Preferred Languages.

You can then use the date variable in e.g. the name of the file in any pattern you'd like.



That's a great tip to allow Hazel to interpret foreign language dates.

In the latest version of macOS, which is Ventura (as of September 2023), you can add the relevant language through settings like this:

Click on the Apple logo, in the top left. Choose System Settings. Click General. Go to Language and Region. In Preferred Languages, at the top, add (click "+") the langiuage(s) of your choice. Leave English as your Primary language unless you want a different one.
Trickyt57
 
Posts: 55
Joined: Tue Sep 18, 2018 12:17 am


Return to Tips & Tricks - DO NOT POST QUESTIONS