All posts

Posts tagged with: Localization

7 posts found

Close-up of printed calendar pages with rows of dates
Swift Foundation

Calendar.current Isn't Always Gregorian. In Thailand, It's the Year 2569.

Calendar.current follows the user's chosen calendar, so on a phone set to the Buddhist or Japanese calendar, component(.year) returns 2569 or 8 instead of 2026. Here's how that breaks card expiry checks, age gates, filenames, and date math in Swift apps, and how to fix it with an explicit Gregorian calendar.

9 min read
A red vintage tram on a snowy Istanbul street with pedestrians walking past
Swift Foundation

You Shipped a Turkish Localization. Now "INFO" Lowercases to "ınfo" and Your String Matching Is Broken.

localizedLowercase and lowercased(with: .current) follow Turkish casing rules, where I lowercases to dotless ı and i uppercases to dotted İ. Here's how that breaks enum parsing, email normalization, file extensions and dictionary keys in Swift apps, why it only shows up after you add a Turkish localization, and the rule that fixes it.

8 min read
Close-up of a calculator keypad with number keys
Swift SwiftUI

Your Digits-Only TextField Accepts "½". Then Int() Returns nil and the Save Button Does Nothing.

Swift's Character.isNumber is true for ½, Ⅻ, Arabic-Indic and full-width digits, but Int(String) only parses ASCII 0-9. Here's how a numeric TextField filter lets input through that your parser silently rejects, plus the isWholeNumber, ASCII-only and locale-aware fixes, Regex asciiOnlyDigits(), and the tests that catch it.

8 min read
A small cafe storefront with its name painted on a sign above the door
Swift SwiftUI

Your Search Bar Can't Find "Café" When the User Types "cafe". String.contains Is Exact.

Filtering a SwiftUI list with String.contains or lowercased().contains misses accents, and users don't type accents. Here's why "cafe" never matches "Café", the difference between localizedCaseInsensitiveContains and localizedStandardContains, how to do it in SwiftData #Predicate, how to keep big lists fast, and the test that catches it.

9 min read
Rows of small wooden library card catalog drawers, each labeled for a range of the alphabet
Swift iOS Development

Your List Sorts "Track 10" Before "Track 2" and "Zebra" Before "apple". Swift's < Isn't Alphabetical.

Sorting user-facing strings with < in Swift compares Unicode scalar values: uppercase before lowercase, accented letters at the end, and numbers digit by digit. Here's how localizedStandardCompare, compare(options:locale:) and KeyPathComparator fix it, and when you should keep using <.

8 min read
A pile of euro coins next to a receipt
Swift Localization

String(format: "%.2f", price) Works Perfectly on Your Phone. It Breaks the Moment Someone's Set to German.

String(format:) and Double(String) both quietly assume a decimal point. Set your device region to Germany, France, or half of Europe and that assumption flips to a comma — and your price parsing breaks in ways your test suite never sees.

6 min read
Overhead airport direction signs printed in several languages at once
Localization SwiftUI

String Catalogs Made Localization Easy. Then I Found the Four Things They Don't Catch.

Xcode's String Catalogs replaced .strings files and genuinely fixed the worst parts of iOS localization. But automatic string extraction has blind spots — interpolation, plurals, SwiftUI initializers, and the layout that breaks in German. Here's what still needs a human.

7 min read