Skip to:
Content
Pages
Categories
Search
Top
Bottom

Localized time stamp broken with 2.7 update

  • @adjunkten

    Participant

    Hello,

    First, thanks again for developing and maintaining Buddypress!

    I have a small problem with time stamps in activity updates and on member profiles.
    It seems my site first loads localized text for time stams, for instance ‘1 hour ago’, but since 2.7 it quickly changes to English.

    Link to live site activiy feed

    How can I fix this?

    Thanks,

    Lars

Viewing 13 replies - 1 through 13 (of 13 total)
  • @djpaul

    Keymaster

    What language is your site running?

    @adjunkten

    Participant

    Sorry, Danish.

    @djpaul

    Keymaster

    @r-a-y Since you worked on this. Any ideas?

    @jonaskjodt

    Participant

    Your time stamps looks correct, I’m guessing you mean the Danish translation isn’t working correctly?

    You can grab the newest Danish Buddypress translation here https://translate.wordpress.org/locale/da/default/wp-plugins/buddypress followed by merging your current buddypress-da_DK.po file in poedit like this http://www.marketpressthemes.com/blog/how-to-merge-two-po-files-using-poedit/, translate the words you needs to translate, save it as both buddypress-da_DK.po and buddypress-da_DK.mo – and reupload it to your server in your language folder.

    @r-a-y

    Keymaster

    BP 2.7 introduced dynamic timestamps using livestamp.js and moment.js.

    For dynamic timestamp localization to work correctly, we try to load the moment.js localization file.

    It is quite possible that moment.js does not come with a Danish translation.


    @adjunkten
    – Can you check to see if there is a Danish translation here?
    https://github.com/moment/moment/tree/develop/locale

    If so, can you output your WordPress locale using get_locale()? There might be a bug in how we are checking for the moment.js locale file.

    @danbp

    Participant

    @r-a-y The danish locale for moment.js use “da” extension. As you ask for check, i assume it is confusing when BP translation is using “da_DK” ? 🙂

    https://github.com/moment/moment/blob/develop/locale/da.js

    @r-a-y

    Keymaster

    I tested by switching my WordPress locale to da_DK and the dynamic timestamp is loading da.js correctly.


    @adjunkten
    – If you want to help debug, can you add the following line:

    var_dump( $locale );

    after lines 31 and 42 of this file?
    https://buddypress.trac.wordpress.org/browser/tags/2.7.0/src/bp-core/bp-core-cssjs.php?marks=31,42#L22

    @adjunkten

    Participant

    Thanks for looking in to this.


    @r-a-y
    , I would like to help, but I can’t locate ‘livestamp.js’ in the bp-core folder?

    Sorry, but I feel a bit noobish here…

    @adjunkten

    Participant

    I noticed this message when inspecting css :

    http://historielaerer.dk/wp-content/plugins/buddypress/bp-core/js/vendor/moment-js/locale/da.min.js’%20defer%20onload=’?ver=2.7.2
    Failed to load resource: the server responded with a status of 404 (Not Found)

    @r-a-y

    Keymaster

    @adjunkten – The defer%20onload is a sign that you might be using a plugin to do something to all WordPress javascript enqueued files.

    Because if you remove the defer line, the JS file is valid:
    http://historielaerer.dk/wp-content/plugins/buddypress/bp-core/js/vendor/moment-js/locale/da.min.js

    Are you using such a plugin? If so, disable it and see if that fixes your problem.

    @adjunkten

    Participant

    Thanks @r-a-y, it looks like you are on to something.

    I use Autoptimize to compress html and css -but I have excluded javascript.

    I tried to deactivate it and purged cache, but it still changed from Danish to English. – the ‘deferonload’ bit was still in the code.

    Will dig more into this when I get the time.

    Lars

    @adjunkten

    Participant

    The defer%20onload is a sign that you might be using a plugin to do something to all WordPress javascript enqueued files.

    Sorry, I disabled a code snippet that defers javascript – that solved the problem.

    @alenabluebox

    Participant

    I have the same problem but deactivating the autoptimize plugin didnt help! Please help me to solve the problem.

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Skip to toolbar