Skip to content

pitis/perch#18: Task dates beyond English: numeric dates, Romanian, and other languages via Apple Intelligence - #28

Merged
pitis merged 4 commits into
mainfrom
autopilot/pitis-perch-18-locale-dates
Nov 13, 2026
Merged

pitis merged 4 commits into
mainfrom
autopilot/pitis-perch-18-locale-dates

Conversation

@pitis

@pitis pitis commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Refs #18

Task dates are no longer English-only. This covers all three checkboxes of the ticket. Your answer on the ticket was "all languages, Romanian included", and that settled the first one.

What changed

Romanian, built into the parser (NLParser.fromRomanian)

  • Romanian dates and times are rewritten into the English phrases the parser already reads, before parsing. Every other word is left alone, so the title stays Romanian: "sună-o pe mama mâine la 5" gives Sună-o pe mama, tomorrow at 17:00.
  • Covered: azi/mâine/poimâine, diseară, the weekdays (also "sâmbăta viitoare"), "3 decembrie", "la (ora) 5 / 14:30 / 7 seara / 9 dimineața", "la prânz", "mâine dimineață/seară", "în/peste 2 ore / 30 de minute / 3 luni", "în fiecare zi / luni și joi", zilnic/săptămânal/anual, "până (pe) vineri" as a deadline, and "pe 3 decembrie / 25.12".
  • Diacritics are optional ("maine dimineata" works). Words that are also ordinary words only count in a date's context: "mai" (more, or May) only after a day number, "luni" (months, or Monday) not after a number, "la" and "pe" only before a time or a date. So "du-te la magazin", "mai multe ouă" and "pune pe 2 farfurii" stay plain titles.
  • It's built in because Apple's on-device model doesn't support Romanian (its 24 languages are listed by SystemLanguageModel.supportedLanguages), and neither does NSDataDetector. The composer preview shows Romanian dates as you type.

Every other language, through Apple Intelligence (AutoClassifier, Workspace.applySchedule)

  • The model call that already suggests a priority and project now also returns the title without its date, and that date rewritten in plain English ("Dienstag um 14 Uhr" → "tuesday at 2pm"). The tested English parser does the date maths, which models get wrong.
  • It only applies to tasks the parser found no date in, so English and Romanian behave exactly as before. It's skipped when the title didn't get shorter (a date that took no words from the text was made up), or when the task was edited in the meantime.
  • It's under the existing Apple Intelligence switch, renamed "Fill in priority, project and dates", with the footer saying what it does. The notepad's "line to task" path goes through it too.

Numeric dates in the Mac's date order, and recordings in any language (first commit, unchanged): 12/25 vs 25.12 follows the locale's short date format. Recordings are matched by the name macOS gives them in your language, read from screencaptureui's own strings.

Snapshot.swift: the Settings snapshot is 1400pt tall instead of 1100, because the Apple Intelligence section was cut off.

How it was tested

  • make check: 44 tests pass. New tests: testRomanian (25 phrases, including inputs that must stay plain titles), testNumericDatesFollowTheLocalesOrder, and testAnotherReadingOfThePhraseSchedulesIt (applies a German reading, keeps the day for a deadline, an edit made meanwhile wins, no date and a made-up date both change nothing).
  • The model path was not run. On this Mac SystemLanguageModel.default.availability is modelNotReady, so I couldn't see what it actually returns for German or French text. The code around it is tested with fixed readings.
  • Not run for real: I didn't type into the app's composer, use dictation, or make a real recording, hence Refs, not Closes.
  • Before/after Settings screenshots are in a comment. Main was rendered at the same taller height so the two match. Since the model isn't ready here, they show the "Needs macOS 26…" footer, not the new one.
  • Review: /pr-review-toolkit:review-pr and /ponytail:ponytail-review were run. The fixes are in the review comment below.

Known limits

  • Dates read by the model show up a moment after adding, not in the composer preview.
  • Without Apple Intelligence, only English and Romanian are understood.
  • In en_US, 1/2 cup reads as January 2. In a locale that writes dates with dots, a bare 25.12 needs its closing dot or a year, or pe/on/by before it. Lowercase maine reads as tomorrow. "2 mai multe" reads "mai" as May. A first name like "Marti" reads as Tuesday.
  • Year-first numeric dates (2026/12/25) aren't parsed.

…ames

Numeric dates such as 12/25, 25/12 or 25.12.2026 are parsed using the
locale's short date format for the day/month order and separator.
Screen recordings are recognised by the name macOS gives them in the
user's language, read from screencaptureui's own strings.
@pitis pitis mentioned this pull request Nov 8, 2026
3 tasks
…ntelligence

Romanian dates and times are rewritten into the English phrases the
parser already reads, so titles keep their own words. Diacritics are
optional. For other languages, the on-device model rewrites the date in
English after the task is added, and the parser does the date maths.
The Settings snapshot is taller so the Apple Intelligence section shows.
@pitis pitis changed the title pitis/perch#18: Read numeric dates in the Mac's order and recognise recordings in any language pitis/perch#18: Task dates beyond English: numeric dates, Romanian, and other languages via Apple Intelligence Nov 8, 2026
@pitis

pitis commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Settings → Apple Intelligence (the only screen this changes). Both are rendered with sample data; the model isn't ready on this Mac, so the footer shows the unavailable text.

Before After
Before After

The model's title is only taken when it's the task's own words with some
removed, and only for languages the parser can't read; it now reads the
cleaned title instead of the raw text, and a finished task is left alone.
A bare dotted pair such as 26.1 or 2.5 is no longer a date unless it ends
in a dot, has a year, or follows on or by. Romanian words no longer match
capitalised names (Maine, LA, Joi), luni after a quantity, la before a
number and a noun, or the adjective anual, and a rewrite the parser
doesn't use is undone. Dates that don't exist aren't stored, 7.30pm reads
like 7:30pm, model failures are logged, and the Settings footer says what
the model really does.
@pitis

pitis commented Nov 13, 2026

Copy link
Copy Markdown
Owner Author

Review

Ran /pr-review-toolkit:review-pr (code, error handling, tests, comments) and /ponytail:ponytail-review on git diff origin/main...HEAD. Fixes are in 75d1864. make check: 45 tests pass. Every new assertion failed before the fix. swift build gives no warnings. The screens look the same as the shots already posted: the model isn't ready on this Mac, so Settings still shows the "Needs macOS 26" footer rather than the new one.

Fixed

  1. Critical: the model could replace the user's title with any shorter text. "Arzt anrufen morgen um 14 Uhr" could become "Call doctor" for good, with no undo. applySchedule now takes the model's title only when it's the task's own words with some removed, in order (isShortened), and capitalizes it like the parser does. Test: the "Call doctor" case.
  2. Critical: in dot-date locales, including this Mac's en_US@rg=at, versions and amounts became dates. "Update to macOS 26.1" was due 2027-01-26, and "Buy 2.5 kg flour" became "Buy kg flour" on May 2. Now a bare pair written with the locale's separator needs its closing separator or a year ("25.12.", "25.12.2026"), unless "on", "by", "pe" or "până" comes first. Slash dates are unchanged. Tests: three must-stay-plain inputs, plus pay rent by 25.12 in de_DE.
  3. Important: the model read the raw text. That included #tags, !priority and the notepad's - [ ] marker, which could come back into the title or block a real date. It now reads task.title, as it did on main, and the from: parameter is gone.
  4. Important: English tasks without a date went to the model too, contrary to the footer and PR text. The date reading now only runs when NLLanguageRecognizer says the title isn't English or Romanian.
  5. Important: English names were read as Romanian. "Drive to Maine" became tomorrow. "flight to LA 9:30", "email Joi", "lunch with Azi" and "gym PE monday" lost words. A Romanian rewrite now skips a match that's capitalized past the start of the text. Test: testEnglishNamesAreNotRomanian.
  6. Important: "luni" (months) read as Monday after a quantity. Affected: "abonament pe două luni", "următoarele luni", "luni de zile". Fixed with a quantity lookbehind and luni de zile.
  7. Important: "la" + number + noun became a time. Affected: "trimite email la 3 colegi", "rezervare la 7 persoane". A bare "la N" is now a time only at the end, before punctuation, or before another date word. "la ora N" is always a time.
  8. Important: bare "anual" (the adjective) made a yearly repeat. Dropped. "în fiecare an" still works.
  9. Important: English words leaked into Romanian titles. Examples: "Sună la bancă and thursday", "Factura by 25.12". When the title holds a word that wasn't typed, parse now reads the text again without Romanian, so the title stays as typed and nothing is lost.
  10. Important: "film la 7.30 seara" lost its time and left "Film at 7." in the title. The am/pm clock now accepts 7.30pm as well as 7:30pm.
  11. Important: dates that don't exist were stored. "31/11" and "february 30" created day keys no view shows. monthDay now checks the date with the calendar.
  12. Important: model failures were silent. The catch now logs through NSLog, like MCPSocket.
  13. Important: comments and footer. The Settings footer says what happens: "When a task's date is in a language Perch doesn't read itself, such as German or Japanese, the model fills it in and takes those words out of the title." Also corrected: the classify, AutoClassifier, applySchedule, fromRomanian and NumericDate docs.
  14. Suggestions, taken: a task finished before the reply arrives is left alone (test added), and the model's date is read as of when the task was added, so a reply after midnight doesn't shift "tomorrow".

Declined

  • The composer re-parses about 9 times per keystroke (about 12 ms). That's how parsed was already used on main. Caching it is a separate change.
  • MCP reads numeric dates in the Mac's order. That's how MCP worked before this PR. AI clients send ISO dates through the date fields.
  • "lunea"/"joia" as a weekly repeat, "într-o oră", "lunar", "până la 5" as a deadline, the trailing "." after a de_DE deadline. These are gaps, not wrong results. Left as known limits.
  • An evening word plus a small hour ("diseară la 9") gives 09:00. This was already on main for English ("tonight at 9").

Known limits, updated

  • Lowercase "maine" still reads as "mâine" (tomorrow). Capitalized "Maine" doesn't.
  • In en_US, 1/2 cup, 3/4 and 8/10 still read as dates, since slash dates stay bare.

@pitis
pitis merged commit 10d0367 into main Nov 13, 2026
@pitis
pitis deleted the autopilot/pitis-perch-18-locale-dates branch November 13, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant