Problem/Motivation

The commerce_canadapost_get_language() only takes into account two letter language codes. It should use the en-CA/fr-CA if they exist. I've got a en-CA and en-US site that will likely grow to include fr-CA soon.

Proposed resolution

Check string length and return full code from that function.

Remaining tasks

User interface changes

API changes

Comments

joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new1.23 KB

Here's what I'm thinking. The lower case cache id doesn't matter and this should keep some backwards compatibility with the two character fr code.

joelpittet’s picture

StatusFileSize
new1.23 KB
new523 bytes
+++ b/commerce_canadapost.module
@@ -433,7 +433,8 @@ function commerce_canadapost_service_markup($rate) {
+  return $langcode == 'fr' || $langcode) == 'fr-ca' == 'fr' ? 'fr-CA' : 'en-CA';

Whoops made a syntax error.

  • iswilson committed 2f32025 on 7.x-2.x authored by joelpittet
    Issue #2429011 by joelpittet: commerce_canadapost_get_language() to use...
iswilson’s picture

Assigned: Unassigned » iswilson
Status: Needs review » Fixed

Committed, thanks again.

There's a whole bunch of fr-XX language codes, so I made it compare the first two letters instead of the entire thing.

Status: Fixed » Closed (fixed)

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