NSDate-TimeAgo

https://github.com/kevinlawler/NSDate-TimeAgo

NSDate+TimeAgo has merged with DateTools. DateTools is the parent project and Matthew York is the project head.

NSDate+TimeAgo是一个处理日期用的工具,他是Matthew York项目中的一部分.

This project is now part of DateTools. Please visit https://github.com/MatthewYork/DateTools

你可以在 https://github.com/MatthewYork/DateTools 中查看相关信息.

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 NSDate. It gives NSDate the ability to report times like "A moment ago""30 seconds ago""5 minutes ago""Yesterday""Last month""2 years ago", and so on.

这是用于苹果开发中的关于NSDate的category.你可以这么用"A moment ago""30 seconds ago""5 minutes ago""Yesterday""Last month""2 years ago"

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"特性

NSDate+TimeAgo 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)

If you know a language not listed here, please consider submitting a translation. Localization codes by language.

如果你的母语不在这份列表中,你可以可以提供一份翻译的列表.

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

这份源码需要我们一起来维护,如果你喜欢,贡献你的一份力量吧.

Use

  1. Add the files to your project - manually or via Cocoapods (pod 'NSDate+TimeAgo') 你可以直接拖源码,或者是使用Cocoapods
  2. Import the header using #import "NSDate+TimeAgo.h" 然后倒入头文件
  3. Call the timeAgo method in the following way: 调用
NSDate *date = [[NSDate alloc] initWithTimeIntervalSince1970:0];
NSString *ago = [date timeAgo];
NSLog(@"Output is: \"%@\"", ago);
2011-11-12 17:19:25.608 Proj[0:0] Output is: "41 years ago"

2 other methods are available: 当然也支持这些方法

  • dateTimeAgo: returns times with only strings of the type: "{value} {unit} ago"
  • dateTimeUntilNow: returns only "yesterday" / "this morning" / "last week" / "this month" -- less precise than dateTimeAgo but more natural

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

Future Directions

Would be nice to

  1. add customization options (e.g., should it report seconds or just "a minute ago") 添加定制选项
  2. add string customization 添加string的定制
  3. have more localizations 更多的本地化语言
  4. make dateTimeUntilNow more precise: instead of "Last week" use "Last Friday", "Last Monday" etc.
  5. other

License

Released under ISC (similar to 2-clause BSD)

http://wikipedia.org/wiki/ISC_license

Credits

Originally based on code Christopher Pickslay posted to Forrst. Used with permission.http://twitter.com/cpickslay

Ramon Torres began support for internationalization/localization. Added es strings. http://rtorres.me/

Dennis Zhuang added zh_Hans Chinese Simplified strings. http://fnil.net/

Mozart Petter added pt_BR Brazilian Portuguese strings. http://www.mozartpetter.com/

Stéphane Gerardot added fr French strings.

Marco Sanson added it Italian strings. http://marcosanson.tumblr.com/

Almas Adilbek added ru Russian strings. Extended logic to support Russian idioms.http://mixdesign.kz/

Mallox51 added de German strings. https://github.com/Mallox51

Tieme van Veen added nl Dutch strings. http://www.tiemevanveen.nl

Árpád Goretity added hu Hungarian strings. http://apaczai.elte.hu/~13akga/

Anajavi added fi Finnish strings. https://github.com/anajavi

Tonydyb added ja Japanese strings.

Vinhnx added vi Vietnamese strings. http://vinhnx.github.io/

Ronail added zh_Hant Traditional Chinese strings. https://github.com/ronail

SorinAntohi added ro Romanian strings. https://github.com/SorinAntohi

spookd added da Danish strings. https://github.com/spookd

Barrett Jacobsen added cs Czech strings. https://github.com/barrettj

Dmitry Shmidt added nb Norwegian strings. https://github.com/shmidt

Martins Rudens added lv Latvian strings. https://github.com/rudensm

Osman Saral added tr Turkish strings. https://github.com/osrl

analogstyle added ko Korean strings. http://almacreative.net/

Flavio Caetano fixed pt Portuguese strings. http://flaviocaetano.com

kolarski added bg Bulgarian strings. http://github.com/kolarski

Vladimir Kofman added he Hebrew strings. https://github.com/vladimirkofman

Viraf Sarkari added ar Arabic, gre Greek, pl Polish, sv Swedish, and th Thai strings.https://github.com/viraf

Vasyl Skrypii added uk Ukranian strings. https://github.com/medlay

Maggi Trymbill added is Icelandic strings. https://github.com/grundvollur

Erid Bardhaj added sq Albanian strings. https://github.com/eridbardhaj

[翻译] NSDate-TimeAgo的更多相关文章

  1. <转>iOS性能优化:Instruments使用实战

    最近采用Instruments 来分析整个应用程序的性能.发现很多有意思的点,以及性能优化和一些分析性能消耗的技巧,小结如下. Instruments使用技巧 关于Instruments官方有一个很有 ...

  2. iOS性能优化:Instruments使用实战

    iOS性能优化:Instruments使用实战   最近采用Instruments 来分析整个应用程序的性能.发现很多有意思的点,以及性能优化和一些分析性能消耗的技巧,小结如下. Instrument ...

  3. iOS---性能优化

    最近采用Instruments 来分析整个应用程序的性能.发现很多有意思的点,以及性能优化和一些分析性能消耗的技巧.小结如下. Instruments使用技巧 关于Instruments官方有一个很有 ...

  4. 最近采用Instruments

    最近采用Instruments 来分析整个应用程序的性能.发现很多有意思的点,以及性能优化和一些分析性能消耗的技巧,小结如下. Instruments使用技巧 关于Instruments官方有一个很有 ...

  5. iOS性能优化

    最近采用Instruments 来分析整个应用程序的性能.发现很多有意思的点,以及性能优化和一些分析性能消耗的技巧,小结如下. Instruments使用技巧 关于Instruments官方有一个很有 ...

  6. OS快速开发必备

    github:https://github.com/koknine (终于改成以前的了) 当前移动互联网行业太火爆,移动端的需求日益增长,很多开发人员每天都应对着各种需求,作为一名iOS开发人员,对于 ...

  7. Instruments使用实战

    http://www.cocoachina.com/ios/20150225/11163.html 最近采用Instruments 来分析整个应用程序的性能.发现很多有意思的点,以及性能优化和一些分析 ...

  8. iOS - 性能优化:Instruments使用简介

    最近采用Instruments 来分析整个应用程序的性能.发现很多有意思的点,以及性能优化和一些分析性能消耗的技巧,小结如下. Instruments使用技巧 关于Instruments官方有一个很有 ...

  9. iOS开发中可能有用的那些分类们Categories

    Categories是给你得不到源码的classes增加功能的一种方法. UIImageView+FaceAwareFill 这个类别使用了Aspect Fill内容模式,可以自动根据图像内容进行调整 ...

随机推荐

  1. ELK日志系统之通用应用程序日志接入方案

    前边有两篇ELK的文章分别介绍了MySQL慢日志收集和Nginx访问日志收集,那么各种不同类型应用程序的日志该如何方便的进行收集呢?且看本文我们是如何高效处理这个问题的 日志规范 规范的日志存放路径和 ...

  2. 探秘varian:优雅的发布部署程序

    上一篇文章<记一次诡异的故障排查经历>中有介绍到我们的部署程序varian,文章发布后有小伙伴对varian很感兴趣,今天就简单的介绍一下我们的varian,揭开她神秘的面纱~ 什么是va ...

  3. java学习-MD5消息摘要算法

    md5 属于hash算法一类,是不可逆的消息摘要算法.与对称加密和非对称加密算法不一样,不需要加密密钥. 注意: md5不是加密算法,只是将数据进行散列计算后生成一个唯一值的算法,没有加密密钥也没有解 ...

  4. Centos虚拟机SVN的安装和使用http方式访问svn服务器

    1.查看是否安装旧版SVNrpm -qa | grep subversion2.卸载旧版本SVNyum remove subversion3.安装SVNyum -y install subversio ...

  5. Redis运行流程源码解析--转载

    http://blog.nosqlfan.com/html/4007.html http://www.searchdatabase.com.cn/showcontent_62166.htm 导读:本文 ...

  6. js / jquery 获取和设置 FCK Editor 的值

    开发中遇到 通过 $("#content").val(); 或者 document.getElementById("content"); 并不能获取到 id 为 ...

  7. Microsoft SQL SERVER 2008 R2 REPORT SERVICE 匿名登录

    SQL SERVER 2008 R2 是微软目前最新的数据库版本,在之前的SQL SERVER 2005中,我们可以通过修改IIS对应的SSRS站点及SSRS的配置文件,将SSRS配置成匿名登录的方式 ...

  8. 对于单文本或者div的内容怎么在显示东西过多的情况下实现显示隐藏

    js代码: $(function () { var o = document.getElementById("newsdetail_ArticleContent"); Subt(o ...

  9. K:图的存储结构

      常用的图的存储结构主要有两种,一种是采用数组链表(邻接表)的方式,一种是采用邻接矩阵的方式.当然,图也可以采用十字链表或者边集数组的方式来进行表示,但由于不常用,为此,本博文不对其进行介绍. 邻接 ...

  10. CSS页面重构“鑫三无准则”之“无图片”准则——张鑫旭

    一.再说关于“鑫三无准则” “鑫三无准则”这个概念貌似最早是在去年的去年一篇名叫“关于Google圆角高光高宽自适应按钮及其拓展”的文章中提过.这是自己在页面重构的经验中总结出来的一套约束自己CSS的 ...