From 3ee67c1dc8acd8d32393ebd9fbeb7f7fdbbef901 Mon Sep 17 00:00:00 2001 From: "C.W. Betts" Date: Wed, 20 May 2026 15:10:36 -0600 Subject: [PATCH] Update GetMetadataForFile.swift Use NSLocale/Locale to get a value that Spotlight likes. --- mdimporter/GetMetadataForFile.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mdimporter/GetMetadataForFile.swift b/mdimporter/GetMetadataForFile.swift index 4ae50b3..6c037ec 100644 --- a/mdimporter/GetMetadataForFile.swift +++ b/mdimporter/GetMetadataForFile.swift @@ -383,6 +383,6 @@ private func setDate(_ key: CFString, _ value: String, in attrs: NSMutableDictio private func appendLanguage(_ key: CFString, _ value: String, in attrs: NSMutableDictionary) { let lvalue = value.lowercased() if lvalue == "und" || lvalue == "unk" { return } - // Can't think of an easy way of sanitising input, so just pass though whatever we find and hope for the best - append(key, lvalue as CFString, in: attrs, allowDuplicates: true) + let cocoalValue = Locale.canonicalLanguageIdentifier(from: lvalue) + append(key, cocoalValue as CFString, in: attrs, allowDuplicates: true) }