Call the civicrm function to get the equivalent in CiviCRM :
CRM_Core_I18n_PseudoConstant::longForShort($drupalLanguage)

CommentFileSizeAuthor
#3 provision_civicrm_1485920_6.x-1.x.patch3.91 KBsluc23

Comments

  • bgm committed bb8fdb2 on 6.x-2.x
    Issue #1485920: Install CiviCRM with the same default language as Drupal...
bgm’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Assigned: samuelsov » bgm
Issue summary: View changes
Status: Active » Fixed

Fixed in provision_civicrm 6.x-2.x, commit bb8fdb28fccd1497220ec93c0c905a25a91fcbe8. http://cgit.drupalcode.org/provision_civicrm/commit/?id=bb8fdb2

It assumes that if Drupal is in French (fr), CiviCRM's language will be fr_FR. We can override the language association by declaring in ~/config/includes/global.inc a global constant such as:

define('PROVISION_CIVICRM_LANGUAGE_MAPPING_FR', 'fr_CA');

A few language/country exceptions are handled explicitely, such as af_ZA, he_IL, zh_CN, etc.

A "nice to have" would be to add a front-end option in hosting_civicrm so that we can choose the language.

NB: due to a limitation in the CiviCRM installer, you still have to switch the language after the installation, but the data will all be in the correct locale. This need to be fixed in CiviCRM core.

NB: if you have issues with "flushing the cache", it's a bug in CiviCRM 4.4.6: https://issues.civicrm.org/jira/browse/CRM-14935

Finally.. note that the diff is bigger than it should be, since this was done while in the process of dropping the duplication of civicrm.drush.inc for #2133493: Error: Cannot redeclare civicrm_drush_command().

Thanks to Ixiam.com for sponsoring the development of this feature.

sluc23’s picture

Version: 6.x-2.x-dev » 6.x-1.x-dev
Assigned: bgm » sluc23
StatusFileSize
new3.91 KB

Hi, I created a patch for this issue for branch 6.x-1.x
Basically uses the function provision_civicrm_language_uf_to_civicrm to determine the civicrm language to use, and then import localized sql data files (if they exist, if not english installation by default)

Status: Fixed » Closed (fixed)

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