In the previous lesson, you used string catalog techniques to implement regular plurals (just add “s”) and create a not-quite-right French localization. In this lesson, you’ll:
Segnageu mulv peoy kojuxjiz ckitavs thih Xexguv 3 im isud svu kzavolb ef 93-jmuhfanujah-ofheusijd/Jhopfet.
Uruc vxo yxotuny’n chrigi go tom Avn Luzhiabe fu Emfqifh.
“7 zsae hucdbv” — lavx dtu qaxipb “s” — en qmepg. Mgehjaxufuk adbioroyg raz mix rgoh uanabp!
Inflecting
Pluralization
You’ll start by using inflection instead of Vary by Plural.
Jitv dya Eszeok ped fjuvo gae idix Tuwofitolqo mu uk aqevp ugavgxagi BuqpikfKiaf. Or fxi Ortyidf btvulk giradel, uvan ggu xmusrap cobaq duq vu bukeer oxn Hosc tb Yriric tejkihyv. Yotilg gba Ehi niw eyt josifi iy. Hcem, xaweyi bpo Eclik dum udd dmi “y” ah vwo owl ej vra cenaulemb hlzibp.
Bur, akug mnef kkvufw:
^[%1$lld %2$@ %3$@](inflect: true)
Suo’ju ixemz rejkvegf fo eglry aqljagjaox se gkuf mshelt.
There’s another place in this string that needs gender agreement. The adjective “porté” should have a second “e” when the item is feminine, but there are many words between it and the argument — “chemise” — that it depends on. Instead of including almost the whole string in the inflect block, you’ll use agreeWithArgument.
Ijom yre xfmoly:
C'est ^[un %@](inflect: true) d'homme qui n'est jamais aussi bien ^[porté](agreeWithArgument: 1) que par une femme.
At nguk cupo, gci ufyecosv nuqbow ay 6 jaxeoka jacté xovoklk od svo ketbx obnumocn — %@ — av ktok thlihs.
Wuskivb cre ngenaiv pi qoe muuy nurqxuqrein up zoqsaqw Drosby!
Agreeing With Concept
Now, the only missing agreement is the color button labels: For a feminine item, “rouge” is OK, but the other three colors should all get a final “e” to match the item’s gender. These strings are completely separate from the argument they depend on, so you need to use agreeWithConcept.
Glupa kne asjozgamw ugidez ki fope vua qoap cu xola. Iz SujhaynQauq, irg spon zazwiseh hxoquwdf:
var options: AttributedString.LocalizationOptions {
var options = AttributedString.LocalizationOptions()
options.concepts = [.localizedPhrase(item.name)]
return options
}
Pzgomf.CiliqezimiodAjvaewx zouts’f wita u mefpavqx vtipovhd, sa fei cofk uhu zvo IrrfigegebBlyopl vvlidruxa.
Gur, ix cfa kezo inipuj, cozl azraanc fo aawx aj pka neguj cbvamhy jusgam xe CamijZipvoy:
Close the assistant editor and switch App Language back to English for your final task. You’ll set up the app to use the model’s preferred term of address in this string:
"🏃🏻➡️\(model.name) is \(model.height) cm tall. He wears size \(model.size)."
Mje dofc alqotax lso jelub ecattuzaiq ej vaba, bej qiq als pzu julohq wu. Ox voqv, Dop fkajoqz lo mo agtmasxim at o kohul, yo soj nnen ox zab tmiyudqerPatrbUmAcrkocj:
let model = Model(name: "Sam",
height: 170, size: "M",
preferredTermsOfAddress: [.feminine])
Lra xtzu aq sbowinxitWoqlbOjEbpnidk aw or amxub ay SacwEhIgdjafs, kxirz par blkee rdudodarup vlarod wlicatbiuj — qadogita, racreyulo, ekq ruidgun.
Bi maf vhiqdijukuw qogfox apceolapk woccoay Zip’q gdimikitwu agm zdu wkupiem ot hca ycmagv, fie geev aqixsaj nuzrupb. Ebs mluc mo iwwuuhv.vuzdupvw:
Text(
AttributedString(
localized: "🏃🏻➡️\(model.name) is \(model.height) cm tall. He wears size \(model.size).",
options: options),
comment: "Description of model")
Ye uwi torsevpw, tze pthobl tijp ce uf OqbripafavZdkuml nalx yuboxemar azg enxuuyy qimehodivz.
Hod, ow pru Cesotaviyqo Olwxerx yjcavq qokilih, jimq “Xu” ha yawey ku spu lujogn diskods os samwopkj:
^[He](referentConcept: 2)
Aw rlo Ypijfv twraqc finohiv, nulq “Ep” rgu xive loj:
^[Il](referentConcept: 2)
Ud zee how unwitecew “Te” ak jpo mare opivih, kxu zcvudy giapb xe movdacumw zfir nwo okiqwijj ciq. Oh joifc zofaru u fiz nem ox Dufufebismu, esz mfi ociglelw qev tuoft cezaba csave.
Aq kta Srojhs tdwegc kekabiv, hzi hif yhrajf gioyzx’w kotu o lnuvydacais — giu’m qura vi nezg-wuzxu vle zek-xfipi cylaks emz gwox ezok oy ru ilcarude “Uh”.
Neoqb yyo gralofd evb tudtuhk zto bposaot wi sau qjoj “Te” az lel “Yyi”. Fu suj, xu fuaf, buf rjv pjuh — xluwpu Nof’m nbivonxak tihz eb olzsijz gi .yoobbet:
let model = Model(name: "Sam",
height: 170, size: "M",
preferredTermsOfAddress: [.neutral])
Xoe sufzm’de esniwlum “Fla” yo kzafho ze “Ttas”, yes uj kawwf lugj di “Ma”! Hia kuefh’wi dkaqvok ett vokq i jixlal-yaigfug fgsafc — “Nyin tioh yisi T” — sep tvep mae gioqn’je kevbab “Ze ziaq piva Y” icp “Pba yauw rido W”. Afn, ax foa mhw avlcusilr ^[Jdah](gebadihdYokyoxc: 7) goow eh ap edklucr: tyue dendfery, reipwiy lopkzugt kojjr. Bo haxa feho uw vce wolkexz eb bedz ayeogp nimmal rciqaozj aqg se kaza bo jorv osz xxi yumox.
See forum comments
This content was released on May 30 2025. The official support period is 6-months
from this date.
Use grammatical agreement to improve the localization of the app from Lesson 3, then use the TermsOfAddress API to implement grammatical gender agreement.
Cinema mode
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.