天天看點

[翻譯] NSDate-TimeAgo

nsdate-timeago

[翻譯] NSDate-TimeAgo

<a href="https://github.com/kevinlawler/nsdate-timeago" target="_blank">https://github.com/kevinlawler/nsdate-timeago</a>

nsdate+timeago has merged with datetools. datetools is the parent project and matthew york is the project head.

nsdate+timeago是一個處理日期用的工具,他是matthew york項目中的一部分.

this repo is here in archive form. new work should be contributed to datetools.

這個資源隻是一個存檔的形式.我們隻會在new work裡面更新關于這個資源的資訊.

description

this is an ios, objective-c, cocoa touch, iphone, ipad category for <code>nsdate</code>. it gives <code>nsdate</code> the ability to report times like <code>"a moment ago"</code>, <code>"30 seconds ago"</code>, <code>"5 minutes ago"</code>, <code>"yesterday"</code>, <code>"last month"</code>, <code>"2 years ago"</code>, and so on.

這是用于蘋果開發中的關于nsdate的category.你可以這麼用<code>"a moment ago"</code>, <code>"30 seconds ago"</code>, <code>"5 minutes ago"</code>, <code>"yesterday"</code>, <code>"last month"</code>, <code>"2 years ago"</code>

this functionality has variously been referred to as a "time ago", "time since", "relative date", or "fuzzy date" feature.

當然也支援這些"time ago", "time since", "relative date", or "fuzzy date"特性

<code>nsdate+timeago</code> currently supports the following languages:

目前,他支援以下這些語言:

en (english)

es (spanish)

zh_hans (chinese simplified)

zh_hant (chinese traditional)

pt (portuguese)

fr (french)

it (italian)

ru (russian)

de (german)

nl (dutch)

hu (hungarian)

fi (finnish)

ja (japanese)

vi (vietnamese)

ro (romanian)

da (danish)

cs (czech)

nb (norwegian)

lv (latvian)

tr (turkish)

ko (korean)

bg (bulgarian)

he (hebrew)

ar (arabic)

gre (greek)

pl (polish)

sv (swedish)

th (thai)

uk (ukrainian)

is (icelandic)

sq (albanian)

sk (slovak)

如果你的母語不在這份清單中,你可以可以提供一份翻譯的清單.

this project is user driven (by people like you). pull requests close faster than issues (merged or rejected).

這份源碼需要我們一起來維護,如果你喜歡,貢獻你的一份力量吧.

use

<code>add</code> the files to your project - manually or via cocoapods (<code>pod 'nsdate+timeago'</code>) 你可以直接拖源碼,或者是使用cocoapods

import the header using <code>#import "nsdate+timeago.h" 然後倒入頭檔案</code>

call the <code>timeago</code> method in the following way: 調用

2 other methods are available: 當然也支援這些方法

<code>datetimeago</code>: returns times with only strings of the type: "{value} {unit} ago"

<code>datetimeuntilnow</code>: returns only "yesterday" / "this morning" / "last week" / "this month" -- less precise than <code>datetimeago</code> but more natural

those three methods can be interchanged as they have the same signature.

future directions

would be nice to

add customization options (e.g., should it report seconds or just "a minute ago") 添加定制選項

add string customization 添加string的定制

have more localizations 更多的本地化語言

make <code>datetimeuntilnow</code> more precise: instead of "last week" use "last friday", "last monday" etc.

other

license

released under isc (similar to 2-clause bsd)

<a href="http://wikipedia.org/wiki/isc_license">http://wikipedia.org/wiki/isc_license</a>

credits

stéphane gerardot added <code>fr</code> french strings.

tonydyb added <code>ja</code> japanese strings.

繼續閱讀