Page 1 of 1

Matching months as words in foreign languages

PostPosted: Sun Jun 19, 2016 2:29 pm
by hepabolu
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.

Re: Matching months as words in foreign languages

PostPosted: Wed Jan 22, 2020 3:22 pm
by Dave61
Many thanks, just had to solve exactly this problem. Your post saved me a lot of time and grief.

Re: Matching months as words in foreign languages

PostPosted: Thu Sep 22, 2022 10:07 am
by etienne74
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

Re: Matching months as words in foreign languages

PostPosted: Fri Sep 23, 2022 9:22 am
by Mr_Noodle
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.

Re: Matching months as words in foreign languages

PostPosted: Thu Sep 21, 2023 9:59 pm
by Trickyt57
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.