iOS OC NSLocale 本地化資訊

2021-09-22 16:52:46 字數 1021 閱讀 3929

@inte***ce nslocale : nsobject
// 用標示符建立

nslocale *locale1 = [[nslocale alloc] initwithlocaleidentifier:@"zh_cn"];

// 返回系統初始本地化資訊

nslocale *locale2 = [nslocale systemlocale];

// 一直保持在 cache 中,第一次用此方法例項化物件後,即使修改了本地化設定,也不改變

nslocale *locale3 = [nslocale currentlocale];

// 每次修改本地化設定,其實例化的物件也會隨之改變

nslocale *locale4 = [nslocale autoupdatingcurrentlocale];

nscalendar *calendar = [nscalendar currentcalendar];

[calendar setlocale:[[nslocale alloc] initwithlocaleidentifier:@"zh_cn"]];

// 根據不同的 key 返回各種本地化資訊

nsstring *strsymbol = [[nslocale currentlocale] objectforkey:nslocalecurrencysymbol];

nscalendar *calendar = [[nslocale currentlocale] objectforkey:nslocalecalendar];

nslocale *locale = [[nslocale alloc] initwithlocaleidentifier:@"zh_cn"];

nsstring *str = [locale displaynameforkey:nslocaleidentifier value:@"en_us"];

iOS 本地推送(本地通知)

設定本地通知 void registerlocalnotification nsinteger alerttime else 執行通知註冊 本地通知 函式,當應用程式在前台時呼叫 nslog noti notification 這裡真實需要處理互動的地方 獲取通知所帶的資料 nsstring not...

本地化 日誌本地化

目錄 概要執行時日誌 國際化與本地化 定義你的本地化日誌資訊mymsg enum package org.skzr.logging basename charset utf 8 value org.skzr.logging.msglocallog public enum mymsg 定義國際化檔案o...

Dubbo本地存根 本地偽裝(九)

本地存根 本地偽裝 一般情況下,consumer端只有介面,實現全部在provider端。但有時候,provider想讓consumer端執行部分邏輯,如threadlocal 快取,提前驗證引數,呼叫失敗後偽造容錯資料等等。provider端配置 本來stub的邏輯是由provider提供的,但是...