IOS 国际化

Posted by Roy on 2017-04-05
113字预计1分

APP对语言的支持实现

1.首先在解决方案内添加语言的支持
upload successful

2.新建一个 Localizable.strings 文件,选择需要的语言支持

upload successful

upload successful

upload successful

3.在Base 内输入一下代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
yearsAgo = "years ago";
LastYear = "Last year";
monthsAgo = "months ago";
LastMonth = "Last month";
weeksAgo = "weeks ago";
LastWeek = "Last week";
daysAgo = "days ago";
Yesterday = "Yesterday";
hoursAgo = "hours ago";
AnHourAgo = "An hour ago";
minutesAgo = "minutes ago";
AMinuteAgo = "A minute ago";
secondsAgo = "seconds ago";
JustNow = "Just now";

4.在相应的位置处调用

1
NSLocalizedString("yearsAgo",comment:"years ago")


Kommentare: