๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Localization

String Localization

๐Ÿ“’ Localization

 

์ง€์—ญํ™”ํ•˜๋Š” String์˜ init ์ข…๋ฅ˜

init(localized:table:bundle:locale:comment:)

- iOS 15๋ฒ„์ „ ์ด์ƒ๋ถ€ํ„ฐ ์‚ฌ์šฉ ๊ฐ€๋Šฅ

init(
    localized keyAndValue: String.LocalizationValue,
    table: String? = nil,
    bundle: Bundle? = nil,
    locale: Locale = .current,
    comment: StaticString? = nil
)

- localized : stringํŒŒ์ผ๋กœ ์ƒ์„ฑํ•œ ์–ธ์–ด๋ณ„ key value ์ž…๋ ฅ. ์ด ํŒŒ๋ผ๋ฏธํ„ฐ ์™ธ ๋ชจ๋‘ ์ƒ๋žต ๊ฐ€๋Šฅ

- locale : ๋ฐ์ดํ„ฐ ์„œ์‹์„ ์ง€์ •ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ•  ์–ธ์–ด์ , ๋ฌธํ™”์ , ๊ธฐ์ˆ ์  ๊ทœ์น™๊ณผ ํ‘œ์ค€ ์ •๋ณด

- comment : ํ•ด๋‹น key ๊ฐ’์— ๋Œ€ํ•œ ์„ค๋ช… ์ž‘์„ฑ

init(localized:defaultValue:options:table:bundle:locale:comment:)

- iOS 16๋ฒ„์ „ ์ด์ƒ๋ถ€ํ„ฐ ์‚ฌ์šฉ ๊ฐ€๋Šฅ

- ์œ„ initalize์™€ ๋‹ฌ๋ฆฌ defaultValue, option ์„ค์ •์ด ๊ฐ€๋Šฅํ•จ

init(
    localized key: StaticString,
    defaultValue: String.LocalizationValue,
    options: String.LocalizationOptions,
    table: String? = nil,
    bundle: Bundle? = nil,
    locale: Locale = .current,
    comment: StaticString? = nil
)

 


์ฐธ๊ณ  ๋งํฌ

๐ŸŽ Apple Developer - String init

๐ŸŽ Apple Deverloper - String init

728x90