The translation option is not sufficient for proper time localization. The option of downloading language files works best but we needed a way to switch the file as per the current language.
Patch attached, please comment.

CommentFileSizeAuthor
timeago.module.patch713 bytesjosepvalls

Comments

icecreamyou’s picture

Version: 6.x-2.0 » 7.x-2.x-dev
Status: Active » Needs work

I like the idea of looking for language files to include, but I'm not going to bundle them with the module because I can't possibly maintain them (since I don't know any languages other than English and some Spanish and a little Hebrew). So they would need to be treated as library files, i.e. stored in sites/all/libraries.

Also new features need to be written for the D7 branch first and then backported.

+++ trunk/sites/all/modules/contrib/timeago/timeago.module (revision 473)
@@ -18,8 +18,14 @@
-  drupal_add_js($path .'/timeago.js');
+  if(file_exists($path .'/jquery.timeago.'.$language->language.'.js')){
+    drupal_add_js($path .'/jquery.timeago.base.js');
+    drupal_add_js($path .'/jquery.timeago.'.$language->language.'.js');
+  } else {
+    drupal_add_js($path .'/timeago.js');
+  }

No need to have a separate base language file, just loading a language-specific file after the existing timeago.js file will override the language settings. Also, there needs to be a space between "if" and the parentheses, and "else" should be on its own line, and there should be a space between the concatenation operator (.) and the variable ($language->language). (In Drupal 7 there should be a space between the concatenation operator and strings as well.)

icecreamyou’s picture

Status: Needs work » Patch (to be ported)

Committed patch to 7.x-2.x-dev. Needs backport to 6.x-2.x.

icecreamyou’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.