Hi. First thing first, I wanna say thanks for this module. Really helpful. But there are things that can be improved.
Since the language of my site isn't English, I wanted to translate that modal pop-up interface and at the same time theme the date format and then I realized, that it's impossible without some changes in code. So I made a patch to 'autosave.js' and 'autosave.module'.

About 'autosave.js': nothing really special, I've just added output of 'should-be-translatable' strings through 'Drupal.t("")' function, and thus have changed some if-statements. Check out the patch below.

And what about 'autosave.module', I've added an option to choose in 'Autosave settings' the date formatter (from defined in 'admin/settings/date-time/formats') if module 'Date' is enabled, but I have not entirely succeeded in correct outputting of the date format defined by chosen in 'Autosave settings' formatter — after it was set, formatter returns a machine name of it, and then using date_formatter_format() function I'm getting the actual date format, like (Y.m.d). But it actually returns only year, month and day, and when format additionally has time settings, date_formatter_format() just ignores it and outputting only year, month and day values. Anybody knows the solution to fix that or better way to get date format? See the patch below.

Comments

STINGER_LP’s picture

StatusFileSize
new3.2 KB
new3.2 KB
STINGER_LP’s picture

StatusFileSize
new2.56 KB
liquidcms’s picture

hey, yea t() support is certainly something that should have been added to this ages ago. thanks for submitting the patch.

for the date function, since it is simply a string passed to the JS the simplest way to do this is likely just as a theme function around the date.

so rather than:

'saved_date' => format_date($autosaved_form['timestamp'], 'medium'),

something like:

'saved_date' => theme('autosave_date', $autosaved_form['timestamp']),

and then of course the theme hook to declare a theme function and the default theme function.

OR there is already a theme_date() function.

this could possibly be extended to include a larger part of the popup; but likely wouldn't bother for the D6 version.

i am sort of torn on making this an admin setting as the D6 version is pretty old now and no one has once asked to modify this; but, if you really think theming isn't the way to go, then you would likely need to have simply a setting for custom date format, and then use the date module's date_format_date() command (which i think has some odd end of month bugs; but might be ok here). But then we would need to add a dependency on the date module.

liquidcms’s picture

as Crell took over AS for D7 thought i would take a quick look at his code; he does have the t() wrapper in the JS code but also does not handle the date formatting.

liquidcms’s picture

Status: Active » Needs work

hey.. sorry hadn't gotten around to reviewing this, but comments:

- i will commit changes for the t() function but not the date options
- if you can create a patch that adheres to Drupal coding stds (and one that works, autosave_extend.js should not be in line 2) i will commit

STINGER_LP’s picture

OK, thanks. If I'l come up with something, I'll post it.

c960657’s picture

Version: 6.x-2.9 » 6.x-2.x-dev
Status: Needs work » Needs review
StatusFileSize
new3.36 KB

I tested the translation patch (autosave.js_.patch) against 2.10, and I can confirm that it works.

This is an updated version (without the date options) that (hopefully) adheres to Drupal coding standards (space aroung the + operator).

liquidcms’s picture

Title: Suggestions for code improvements » Allow interface translation

better title

quicksketch’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, this is a great patch. I'll review it later today for commit.

quicksketch’s picture

This patch looks and works great. I reviewed it and everything works as advertised. I'm helping Crell update the D7 version of this module and I thought this problem applied to D7 also, but looks like the JS was largely rewritten for the D7 port and none of these problems apply to D7. Since liquidcms is handling the D6 version, I'll leave this for him to commit but it all looks good to me.

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Well, heck I'm committing a bunch of backported patches to D6 for consistency anyway, so I might as well include this one too. It's a solid patch and doesn't introduce any problems. Committed to the 6.x-2.x branch.

Status: Fixed » Closed (fixed)

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