Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post time stamp not localized in Mobile mode #5482

Closed
margori opened this issue Dec 17, 2014 · 8 comments
Closed

Post time stamp not localized in Mobile mode #5482

margori opened this issue Dec 17, 2014 · 8 comments

Comments

@margori
Copy link
Contributor

margori commented Dec 17, 2014

In mobile mode, set language to 'es-AR', post time stamp is shown as 'about 18 hours ago' and I expected 'cerca de 18 horas'.

@svbergerem
Copy link
Member

We already had an issue which has been fixed and closed in May: #4718 (comment) I am not sure if someone checked if the localization is working.

I can confirm this issue.

@Flaburgan
Copy link
Member

I confirm that this bug is still there.

@collimarco
Copy link
Contributor

I successfully reproduced the bug. It is not limited to 'es-AR', but affects any language (e.g. it).

Translation should be available in the Javascript object Diaspora.I18n, however they are not loaded because in mobile version there's no Diaspora initialization, nor Diaspora.I18n.load(…)

I think that it's only some server side code that is missing in the head section of the application layout.

I'm going to investigate this issue further.

@svbergerem
Copy link
Member

Adding the translations doesn't fix this issue (already tried that) but is of course a required task to fix this.

@collimarco
Copy link
Contributor

Added these dependencies in mobile.js:

//= require diaspora
//= require helpers/i18n
//= require widgets/timeago

Also added = load_javascript_localesat the end of application.mobile.haml.

This partially solves the issue because the language gets properly set and the Diaspora.I18n.load() gets called. However, even if it gets executed, it doesn't seem to load the translations, which all result in empty strings.

More in detail the problem relies in the loadfunction:

  • the parameters received are correct and contain the proper translations
  • the function produces empty strings as translations (I mean, if you call Diaspora.I18n.t just after the function you get empty strings, even if those translations were available in input)

Thus also the translations loaded by timeago.js are all empty strings.

A temporary patch would be to prevent timeago.js to load custom translations provided by Diaspora and use those that are already present in the plugin. Otherwise we must understand why in the mobile version Diaspora.I18n.load() doesn't load the translations that it receives in input.

@collimarco
Copy link
Contributor

What I said above is summarized in this commit:

collimarco/diaspora@8f6f71c354cf74

Pull that commit, visit /notifications, and see the Javascript console:

  • when mobile mode is enabled you get (the wrong result):
before Diaspora.I18n.load():
after Diaspora.I18n.load(): 
  • when mobile mode is disabled you get (the correct result):
before Diaspora.I18n.load(): 
after Diaspora.I18n.load(): %d minuti

This means that when in mobile mode Diaspora.I18n.load() doesn't load the translations.

For the rest this commit should fix the issue, because the jQuery plugin (timeago) is now properly called, it just doesn't find the translations.

@collimarco
Copy link
Contributor

Solved! My considerations (#5482 (comment)) were correct, but you also need to add:

//= require underscore

I'll post a commit with the complete solution as soon as possible

collimarco added a commit to collimarco/diaspora that referenced this issue Dec 20, 2014
jaywink added a commit that referenced this issue Jan 17, 2015
@jaywink
Copy link
Contributor

jaywink commented Jan 17, 2015

Fixed via #5489

@jaywink jaywink closed this as completed Jan 17, 2015
@jaywink jaywink added this to the next-major milestone Jan 17, 2015
Faldrian pushed a commit to Faldrian/diaspora that referenced this issue Feb 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants