Dear friends,

I know this is "another issue on translating Ubercart", but I would like to make sure simple issues are shared. This is not the big plan to rework Ubercart, only small issues...

So my situation is:
* i18n taxonomy translation module installed.
* settings.php
$conf['i18n_variables'] = array(
// Site name, slogan, mission, etc..
'site_name',
'site_slogan',
'site_mission',
'uc_catalog_vid',
'uc_catalog',
);
* My taxonomy for catalog is named 'Catalog'.
Translation option is set to:
"Localize terms. Terms are common for all languages, but their name and description may be localized."
IMHO, in small shops, there is only a simple product structure and we only need to translate it.
* Language switcher module installed.

So my first need would be to display the catalog in several languages.
It seems that the catalog block does not support t and tt translation.

Is there a way to fix this?

Kind regards,
Grub

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

grub3’s picture

A patch was proposed there: http://www.ubercart.org/forum/internationalization/13105/how_translate_t...
Could it be reworked to display the catalog block?

grub3’s picture

Status: Active » Needs review
FileSize
5.24 KB

Please find attached the patch proposed on Ubercart forum by alexku (many thanks).
I applied it on our website, it works very well.

There is still an issue, as "Catalog" title is not translated, but this is a rather minor issue.

TR’s picture

Status: Needs review » Needs work

There are a number of problems with your patch. First, it needs to be made in the proper format following http://drupal.org/patch/create. The patch needs to be relative to the ubercart directory, not to the uc_catalog subdirectory. You need to follow Drupal coding standards. In particular, get rid of all the tabs. Remove commented out code, and remove the "fix by alexku" comments.

Also, the patch doesn't seem to take into account the comment from the thread at http://www.ubercart.org/comment/56079.

It would help potential reviewers if you could describe here exactly what the patch is intended to do, including some examples of the current "wrong" behavior and how the patch will change that.

TR’s picture

Also, isn't this essentially a duplicate of #697584: Language switcher does not work well with Catalog ?

grub3’s picture

This issue is dealing with the catalog block.
In Ubercart, the catalog block could never be displayed translated.

Were some of you able to display a translated catalog block using legacy Ubercart ca_catalog?

Kind regards, Grub

grub3’s picture

Okay, I am taking into account your remarks.

grub3’s picture

Priority: Normal » Critical
Status: Needs work » Reviewed & tested by the community
FileSize
3.04 KB

Attached patch works for 3 months in production.
Oping this diff complies with guidelines.

TR’s picture

Priority: Critical » Normal
Status: Reviewed & tested by the community » Needs work

Could you please do what I asked in #3?

And, you can't mark your own patch as "reviewed and tested". I want to see someone other than you try this out.

rlange77’s picture

Hi folks,
I "applied" the patch to my system and didn't get any changes.
For my understanding.
To explaine my problem.
If I use the the default taxonomy link of my products I get the right URL in my language switcher for all other languages.
But if I use the catalog link the language switcher doesnt give me the right URLs.

I changed the uc_catalog based on i18n-catalog-block-v3.diff but the behaivor of the
language switcher didnt change at all.
Any ideas?

stingray’s picture

Fixed titles on catalog grid view

dimitriseng’s picture

Hi, I am using Drupal 6.22, i18n 6.x-1.9, Pathauto 6.x-1.5 and Ubercart 6.x-2.dev.

I have setup the UC catalog with a taxonomy configured as "Localize terms". I have tried #10 but this does not provide all the required functionality.

However, I have managed to get this to work as expected by additionally manually adding the following from the post at http://www.ubercart.org/comment/55148, which is where this patch has originated from and I am not sure why these were missed out from this patch:

- Applied all the changes described in that post to the uc_catalog.pages.inc file.

- Applied the changes suggested in the post in the uc_catalog.module for function uc_catalog_set_breadcrumb.

After all the above were applied, the catalog seems to be working as required when using 2 languages. I will carry out further testing and will report back any issues.

Can somebody please test and confirm if the above additions are required on top of the patch at #10, and if not why that is?

Also, I believe that the patch at #10 will have to be written in the proper format as described in #3. If some more people can test it would be great to get this commited.

On another note, I believe that if a "per terms" taxonomy is used for the catalog, then the fix suggested at the link below fixes this issue, as aslo mentioned in [697584]:
http://www.firewing1.com/node/27#comment-391

Thank you.

derieppe’s picture

subscribe

dimitriseng’s picture

Hi, can somebody review the patch at #10 and my comments at #11? Thank you.

longwave’s picture

The patch is not in unified diff format (diff -u) which makes it harder to review and test.

Also, what happens if the user does not have i18n installed? Seems that tt() is not available in that case.

dimitriseng’s picture

Hi longwave, thanks for the quick reply and the good work you are doing overall of Ubercart.

I have updated UC to 2.6 from 2.4 and have reapplied the code changes as I described in #11. I can confirm that this works fine for UC 2.6 too. The changes are required in the following 2 files of uc_catalog: uc_catalog.module and uc_catalog.pages.inc.

I am not sure what is the exact format that you expect the patch to be in but if you refer me to the appropriate documentation I will try to produce that for you (apologies, I did not create a patch for Drupal before). However, I have attached the updated versions of these 2 files (with a txt extension in order to attache them) that contain all the changes so it would be easy to diff those with the original UC 2.6 files if required. I have also done a simple "diff filename1 filename2" on those 2 files and the output is also attached.

I am using i18n so I have not tested without it and I am not sure what the implications of using tt() would be if i18n is not used. Please let me know of any suggestions on this.

As mentioned in #11, some additional code was added on top of the patch in #10 of this issue in order to get this functionality to work. I have used the code in comment http://www.ubercart.org/comment/55148, but after this there was some extra work that had been done on that which I have not tested.

Let me know of your thoughts on what the best way is to progress this, thank you.

longwave’s picture

Please use diff -up filename1 filename2 to produce a unified diff; this provides more context (lines above and below your actual changes) and makes things easier for reviewers. You do not need to upload the full changed files, just the diff is enough - preferably with a .patch file extension. It is also helpful if you can test and patch against 6.x-2.x-dev rather than 6.x-2.6, though in this case there shouldn't be many changes.

If i18n is not installed (or disabled) I think the code will stop functioning as tt() will no longer be a defined function. You might need to keep the old code in place and use if (module_exists('i18n')) { ... } in order to handle both scenarios.

ShaneOnABike’s picture

subscribe - would be great to get this working :)

JoelMFD’s picture

bump

ShaneOnABike’s picture

bump

dimitriseng’s picture

Hi all. as per my comments in #15, I had managed to get the catalog translated ok in UC 2.6. I have now just started looking at the D7 version and I am trying to figure out what is the best way to setup a fully translated catalog. I see that now things have moved to views which is great, but from a brief play around it looks like there are still issues with translations for the catalog block, as well translations as other things such the titles in the category pages, the breadcrumb etc.

Does the work in this issue still needs to be done for UC 3 on D7, or otherwise can somebody please pointe me to the right direction on the best way to build a fully mulltiingual catalog? Thank you very much!

bettisfr’s picture

Thanks a lot #15 :)

Bitvark’s picture

@dimitriseng (#20):
For D7 you can get Language Switch Block working as suggested by the link you submitted on #11 (http://www.firewing1.com/node/27#comment-391) with this.

Put following code in file "/modules/locale/locale.module" between line 1000 & 1001 (using D7.14)
(Other version: code goes in function "locale_block_view", just after the line "if (isset($links->links)) {")

if (preg_match("/^(catalog\/)([^\/]*)(.*)$/", $path, $matches)) {
  foreach ($links->links as $langcode => $link) {
    if ($str_tids = i18n_taxonomy_translation_term_tid($matches[2], $langcode)) {
      $links->links[$langcode]['href'] = "catalog/$str_tids". $matches[3];
    }
  }
}
absoludo’s picture

A quick way to translate the taxonomy terms is by checking if internationalism is available and then translate the term.

RAWDESK’s picture

I tried to implement #10 without success.
After some experiments with feasible solutions reached out by other contributors, i came up with this quiet simple solution using the i18n_taxonomy_localize_terms() function :
Inside uc_catalog.module :
function uc_catalog_block_view($delta = '') {
- $tree = taxonomy_get_tree($vid);
+ $tree = i18n_taxonomy_localize_terms(taxonomy_get_tree($vid));
}
Prerequisite : In Multilanguage settings for the vocabulary in scope -> set the Localized option as translation method.

TR’s picture

Status: Needs work » Closed (outdated)

D6 is now obsolete, and there have been so many changes in D7 internationalization and Ubercart that I currently have no idea whether this remains a problem. If so, please open a new D7 issue with details about how to reproduce the problem.