CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • dashboard customisation works in En + Fr but not in Nl
Pages: [1]

Author Topic: dashboard customisation works in En + Fr but not in Nl  (Read 2481 times)

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
dashboard customisation works in En + Fr but not in Nl
August 06, 2012, 08:13:22 am
Hi.
I have a 4.1.3 install on the latest drupal 7.
Three languages are configured : En, Fr and Nl.
On a user's homepage, he an configure the dashboard appelts in En or Fr, but in Nl the drag and drop features do not work, all is displayed without the roudned rectangles, and there's no drag and drop.
For other users, this does work, even in Nl.
All I have as a lead is this in the error log :
Type   php
Date   Monday, August 6, 2012 - 17:10
User   han
Location   http://XXXXXXXX/civicrm/ajax/dashboard?op=get_widgets_by_column&key=XXXXXXXXX
Referrer   http://XXXXXXXX/civicrm/contact/reset_1?lcMessages=nl_NL
Message   Notice: Undefined offset: 1 in CRM_Core_BAO_Navigation::createNavigation() (line 598 of /var/www/html/sites/all/modules/civicrm/CRM/Core/BAO/Navigation.php).
Severity   notice
Hostname   XXXXXXXXX
Operations   

Where should I look to find more info i order to solve this ?

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: dashboard customisation works in En + Fr but not in Nl
August 06, 2012, 08:15:15 am
after administer => settings > cleanup caches, this now does happen in NL for all users.
(at least it's consistent now  ;D )

so they have to switch to En or Fr to edit the dashboard config.
What can I do ?


mathieu

  • Administrator
  • Ask me questions
  • *****
  • Posts: 620
  • Karma: 36
    • Work
  • CiviCRM version: 4.7
  • CMS version: Drupal
  • MySQL version: MariaDB 10
  • PHP version: 7
Re: dashboard customisation works in En + Fr but not in Nl
August 06, 2012, 02:04:23 pm
Sounds like a Javascript error that could be caused by a problem in the translation file.

If you are using Firefox, you can install the Firebug extention. When the console is open (click on the Firebug icon), it will display javascript errors and their source in the code (refresh the page to see the error).

In Chrome, you can right-click, then click "inspect element" to open the console. Refresh the page, and see if there is an error.

You should also test CiviCRM 4.1.5. I could not reproduce this bug on the demo site, so it may have been resolved.

You can also try updating only the translation file:
https://github.com/civicrm/l10n/raw/master/po/nl/civicrm.mo  (copy it to civicrm/l10n/nl_NL/civicrm.mo)
CiviCamp Montréal, 29 septembre 2017 | Co-founder / consultant / turn-key CiviCRM hosting for Quebec/Canada @ SymbioTIC.coop

kylnmhanks

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • I am a dedicated person
    • sivananda bahamas
  • CiviCRM version: 2.3
  • CMS version: Joomla
  • MySQL version: 2005
  • PHP version: 9.1
Re: dashboard customisation works in En + Fr but not in Nl
August 07, 2012, 11:45:01 pm
A great thing about tumblr is that there is no end to the amount of customisation you can build into a theme.


sivananda bahamas

kimkennof

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
  • CiviCRM version: 4.1.3
  • CMS version: Drupal
  • MySQL version: 5
  • PHP version: 5.2
Re: dashboard customisation works in En + Fr but not in Nl
October 01, 2012, 01:46:24 am
I'm currently following this issue for ehanuise.

I've tracked down the JS error to a i18n string in javascript, containing single quotes:

 var message = 'Wilt u dit dashlet verwijderen als 'Beschikbaar Dashlet' en het verwijderen van de dashboards van alle gebruikers?';

This ofcourse creates some (serious) issues, as CiviCRM does not properly escape it's Javascript strings... People just can't escape all their strings, so Civi should do it on their end.

After investigation of the TPL files:

var message = {/literal}'{ts escape="js"}Do you want to remove this dashlet as an "Available Dashlet", AND delete it from all user dashboards?{/ts}'{literal};

It seems Civi does properly escape quotes? or am I wrong about the Smarty syntax?

It also seems that Civi English uses double quotes for their quoting purposes, but some languages will ofcourse use single quotes for quoting pleasure...

Is there a way to universally solve this quoting issue?

Greets,
Kim




mathieu

  • Administrator
  • Ask me questions
  • *****
  • Posts: 620
  • Karma: 36
    • Work
  • CiviCRM version: 4.7
  • CMS version: Drupal
  • MySQL version: MariaDB 10
  • PHP version: 7
Re: dashboard customisation works in En + Fr but not in Nl
October 01, 2012, 06:40:09 am
Hi Kim,

I couldn't reproduce to bug, so here is a bit of background on how translation works, hopefully it can help you identify the cause:

* The "ts" function lives in civicrm/CRM/Core/I18n.php, it basically calls either a custom translation function, or (more typically) "CRM_Core_I18n::crm_translate()". Check that your site does not have a "custom translation function" in the Admin->Localization settings. If you do have a custom translation function, it might not be implementing the escaping correctly.

* crm_translate() checks for a special parameter "escape => js" (which the template uses as {ts escape="js"}).  I tested that it works correctly by adding a string with simple-quotes in a .tpl file. Ex: {ts escape="js"}Test 'foo' bar.{/ts} in templates/CRM/Contact/Page/View/Summary.tpl (view contact).

Can you try to add "echo" statements in the crm_translate() function to see if it is going in the right places? Don't forget to clear your smarty cache ("drush cc civicrm, if you have drush/drupal, otherwise add "&directoryCleanup=1" to any URL).

The following pages can provide other debug info:

http://wiki.civicrm.org/confluence/display/CRMDOC42/Debugging
http://book.civicrm.org/developer/current/development-environment/debugging/

Mathieu
CiviCamp Montréal, 29 septembre 2017 | Co-founder / consultant / turn-key CiviCRM hosting for Quebec/Canada @ SymbioTIC.coop

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: dashboard customisation works in En + Fr but not in Nl
October 01, 2012, 06:57:04 am
I will check for this bug in my Dutch installs, but it does not ring a bell?
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

kimkennof

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
  • CiviCRM version: 4.1.3
  • CMS version: Drupal
  • MySQL version: 5
  • PHP version: 5.2
Re: dashboard customisation works in En + Fr but not in Nl
October 01, 2012, 08:07:37 am
Hey guys, thanks for the quick responses!

It seems this issue only appears on our Prod environment, while it is correctly escaping the string in our Dev environment...

I've compared the TPL, the string, the Translation function but no clue...

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: dashboard customisation works in En + Fr but not in Nl
October 01, 2012, 08:55:40 am
Really weird....what happens if you try to debug in the translate function as mlutfy suggested?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

kimkennof

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
  • CiviCRM version: 4.1.3
  • CMS version: Drupal
  • MySQL version: 5
  • PHP version: 5.2
Re: dashboard customisation works in En + Fr but not in Nl
October 02, 2012, 08:41:52 am
Hi fellas,

I had already tried debugging the various functions to trace down the issue, but when I do so on Dev, it properly escapes the single quotes in the JS string.

I can't change files on production to test stuff, and I am confident that both environments use the same code-base.

I manually compared the various i18n files / functions / templates but had to conclude that they were identical. I then did a automated file comparison and again came to that conclusion.


I just tried the "dont forget to clean the cache" option both Drupal (i already did that one, on "admin/config/development/performance") and than, after searching some, through "/civicrm/admin/setting/updateConfigBackend" > button "clean cache".

I don't know if it was Drupal Cache or the CiviCRM cache, but the issue has disappeared.

*double facepalm* for being an experienced Drupal dev, who should know to clear his caches!

Thanks dudes!

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: dashboard customisation works in En + Fr but not in Nl
October 02, 2012, 10:25:40 am
Glad you got it fixed Kim!
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • dashboard customisation works in En + Fr but not in Nl

This forum was archived on 2017-11-26.