In an app I want to show the same amount of money in each user's localized currency. The problem is that in [NSLocale availableLocaleIdentifiers]
, it shows that the currency symbol is tied to the language of the device.
在一個應用程序中,我希望在每個用戶的本地化貨幣中顯示相同數量的金額。問題是在[NSLocale availableLocaleIdentifiers]中,它顯示貨幣符號與設備的語言相關聯。
For the Norwegian Krone for example: locale with identifier "en_NO" gives currency symbol "NOK" but locale with identifier "se_NO" gives currency symbol "kr"
以挪威克朗為例:標識符為“en_NO”的區域設置給出貨幣符號“NOK”,但標識符為“se_NO”的區域設置給出貨幣符號“kr”
I want the user with region set as Norway to see the "kr" symbol, even when his currentLocale language is not swedish.
我希望區域設置為挪威的用戶可以看到“kr”符號,即使他的currentLocale語言不是瑞典語。
Is there any way around that?
那有什么辦法嗎?
Thank you!
0
So you want the people using not Swedish see the symbol the same with the people using Swedish.
因此,您希望使用非瑞典語的人看到與使用瑞典語的人一樣的符號。
But the currency symbol is fetch with function
但是貨幣符號是用函數獲取的
locale.displayNameForKey(NSLocaleCurrencySymbol, value: code)
which means in different language, the symbol is different, so if you want the all users to see a specific symbol, you should bound the symbol with a specific language.
這意味着在不同的語言中,符號是不同的,因此如果您希望所有用戶都能看到特定的符號,您應該使用特定的語言綁定該符號。
Not sure that's a good idea, but you can make a Swedish locale, and get a Swedish symbol with
不確定這是個好主意,但你可以制作一個瑞典語語言環境,並獲得瑞典語符號
NSLocale(localeIdentifier: "se_NO").displayNameForKey(NSLocaleCurrencySymbol, value: code)
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2016/01/22/b790896fac9e9870d3294d21adb70692.html。