I've developed a new module for Drupal for content localization : localizer.

This module offers the following features :
- translates the user's menus
- provides a language switch block
- translates the node's content

This module has been inspired from internationalization module (i18n).
It uses very large portions of code fron i18n module.
Differently from i18n module, localizer doesn't change the url path adding the locale prefix and in this
manner it prevents some problems that this tecnique can generate (for example non activation of the
current link in the menu or in the primay or secondary links groups).
Localizer doesn't need that every node has an url alias.
If you want, it is sufficient that you assign an url alias only to one of the nodes of the translation.
Then the module will display the correct translated node without changing the displayed url.
Localizer doesn't need any patch to the Drupal core.

Localizer offers a block to language switch, but you can
change the language from every link simply adding the
parameter locale to the url, like : locale=en

Two Drupal function have been reimplemented for internal use only :
localizer_locale and localizer_t (corresponding to functions locale and t).
The two new functions make almost the same work, except that they accept a new
parameter : locale. So it is possible to get a translation for a particolar locale through the localizer_t function.

Some features are planned but missing at now :

  • Taxonomy support
  • Blog support
  • Weblinks support
  • Independent view with all untranslated nodes per language
  • More detailed privileges
  • Ability to select on witch nodes types activate the translation

You can download it from here : http://www.speedtech.it/drupal/localizermodule,
or directly from here : http://www.speedtech.it/files/localizer_0.0.1.tgz

Every suggestion is much appreciated : roberto.gerola@speedtech.it

Thank you.

Roberto

Comments

Roberto Gerola’s picture

You can see this module in action directly on my website : http://www.speedtech.it.

esord’s picture

HI,
(excuse my poor english)
i just saw your module, and i want to install it but i have already installed i18n in my site. If i just disable the i18n module (and everything that comes with that in the 4.7 version) and folow the installation instructions will that cause a problem to the nodes already translated, or the links? (Sorry but I am new at this and i do not fully understand what might happen if I do that...)

Thanks

Roberto Gerola’s picture

Hi esord.
It should work without problem.

Localizer uses only its own table : localizer.
It doesn't touch in any manner any other table.

It doesn't touch or modify i18n module tables or data associated.

If you have already inserted the translated content you have only
to assign the translated nodes.
Eventually, if they are a large amount. I can help you writing a SQL
script to populate localizer table.

Before trying localizer, please, disable i18n : never tried with both modules active (no sense).

At now I'm using localizer on two websites without problem.
At now it doesn't work with the cache mechanism enabled.
Be patient, I'm working on it. It is an indispensable feature also for my websites.

Feel free to contact me for every problem.

Bye

esord’s picture

Hi,

first of all thank you for your help ,I have now installed the module and it works fine except from a small problem with the starting page.

I created a node and its translation, and then assigned this node to be the main page of my site (from administer -> settings -> generall settings). I am not using cache at this moment, I use Clean URLs and I am also using 2 translations for my site (one of them is English and this is the default language). I am using the language switcher block so that the user will be able to change from one language to another.

The problem is that when in the main page and not yet logged in (being an anonymous user) the node I choosed to be in the main page appears only when using the default language of the site. When trying to change the language i get an Access denied message. (the url at this point is /drupal/switch/{langname}?destination=node%2F{number of the node}. When changing the language to en - /drupal/switch/en?destination=node%2F{number of the node} again I get access denied). I tried changing the default language to see what happens, but again when tryin to change the language I get the same message.(this could be a result of how I created the nodes?) When logged in I can view both translations of the node without a problem using the switcher block.

I'll apreciate any help you can give me on this...

ps: I think that in the localizer.install file (included with the updated module) on line 8 there is a "," missing at the end of the line.

Thanks again
esord

Roberto Gerola’s picture

Hi esord.
It seems only an access rights issue.
Go to : administer->access control , for localizer module and anonymous user check the privilege : access localizer.

I have corrected the install file. Thank you !

In the past days I have released a version 0.0.2 that now is compatible with cache
and also try to be spiders-friendly, but this seems to be an harder issue to address.

I suggest you to download and use the 0.0.2 version.
There is no db change, only code, it sufficient that you
ovewrite the localizer.module file.

Here you can read the instructions to make the module working
with the cache system and download the updated version : http://www.speedtech.it/drupal/localizermodule

Bye

esord’s picture

Thanks again,

it works fine now (I've installed the latest version 0.0.3 and looking forward for your next releases)

Thanks for your help.
Bye

trantt’s picture

"Before trying localizer, please, disable i18n : never tried with both modules active (no sense)."

I think i18n must be disable before localizer can be uploaded to the module folder. I received the following error message when clicked on the site's module link (i18n was enable and localizeer was already uploaded to my module folder)

Cannot redeclare i18n_get_lang() (previously declared in /homepages/10/d144739142/htdocs/latestdrupal/modules/i18n/i18n.module:22) in /homepages/10/d144739142/htdocs/latestdrupal/modules/localizer/localizer.module on line 259

mclai’s picture

I have the same similar problem. I newly installed localizer while I left the i18n enabled. I could see the localizer shown up on the module when I enabled it. As soon as I enabled localizer, all I got were the blank pages due to the similar error as yours:
Fatal error: Cannot redeclare i18n_get_lang() (previously declared in C:\Inetpub\wwwroot\drupal-5.1\sites\all\modules\i18n\i18n.module:26) in C:\Inetpub\wwwroot\drupal-5.1\sites\all\modules\localizer\localizer.module on line 1224

Note that I am installing and using Drupal on Windows.

Then I went to uncomment the "function i18n_get_lang($setlanguage = NULL)" defined in i18n/i18n.module, hoping that I could at least see the index.php page running. Yes, I did but every page I clicked was "Page not found" :(

So I went back to enable the function in i18n/i18n.module and then uncommented the one defined in localizer/localizer.module (inside the "if (module_exists('localizer')) {...}" block). Yes, I could see the pages now. However, there are no way for me to disabled Localizer and Internationalization mdoles because they are all greyed out. Any idea or how to fix?

Can i18n and Localizer stay together? If not, I guess it would be better to mention it on the doc: http://drupal.org/node/138499 for new users like me to follow the installation instruction.

Indeed in the above doc, the following code should be updated for v5.x.

$conf= array (
'cache_inc' => 'modules/localizer/system/includes/cache.inc',
);

should be changed to

$conf= array (
'cache_inc' => 'sites/all/modules/localizer/system/includes/cache.inc',
);

Otherwise, all pages will become blank.

LittleLocalizer’s picture

Hi

I just installed Localizer (2007-01-22 issue) on my staging machine with Drupal 5.0.
The staging machine runs XAMPP, to be sure to avoid right issues on my first steps I use MySQL's root for Database access.
Also I copied the Localizer Folder to /modules and configure English and German as languages.
When I create content, I can also enter translations as described in "readme".
The Language option for anonymous and athentified users also work.

When I check both languages the english and german contend are displaed sequentially on the front page at the same. Is this by design? In my understanding there should be only one language version at at time unless I select a special bilingual synopis view (Actually I was unable to find ithis option anywhere.) In any case a default language should be selected in on of the described ways (URL, browser locale ...) . I am not sure, if that interpretation of the readme is correct, though.

In the Module Administration it says "Localizer views (disabled)" and also "Views (missing)".
Has that to do withe the issue and how can I turn that on anyway?

I also cannot bring up any flags in the menue.

Where can I find more detailed instructions?

Cheers
LL

nmakarov’s picture

How you did this switching between English and Italiano? I can see links going to
http://www.speedtech.it/switchuilocale/en?destination=home, but what is it behing the scenes? A function call?

Roberto Gerola’s picture

I've updated my localizer module for Drupal.

  • Now it works also with the cache system of Drupal with two little changes to the Drupal core files (common.inc and bootstrap.in under includes subdirectory).
  • Another update is related to spiders behaviour (thanks marc.bau on Drupal forum for the hint).
    Now the switcher block calls the page in the selected locale passing on the url the locale parameter in the form : http://www.example.com/mypage?locale=it.
    In this manner every page has also a link to its translated versions and the translation system doesn't have to rely on locale variable stored in session when called from the language switch block, but receives directly the selected locale on the url.

For complete description and download :
http://www.speedtech.it/drupal/localizermodule
http://www.speedtech.it/files/localizer_0.0.2.tar.gz

Roberto Gerola’s picture

  • Localizer supports now 2 differents type of url for language switching
    - you can append the locale parameter following by the language : locale=en, locale=it, locale=fr, and so on
    - you can create url alias prefixing the 2 letters of the country code : it/home, en/ home, fr/home.

    You can make the url alias pointing also to the same node, it is indifferent.
    If available, for constructing the links of the switching block, localizer uses the url alias (more SEO friendly),otherwise it continues to use the first form.
    The switch method called is sufficient to change the language, I have added the parameter only to make the url more usable by the search engines.

  • Menu expansion
    To make the language switch working with url alias two patches has been implemented to make the menu working correctly.
    This patches are also available for i18n module at this links :
    http://drupal.org/node/80820
    http://drupal.org/node/82817
  • Replaced and extended flags icons
    (thanks to Mark James : http://www.famfamfam.com/lab/icons/flags/

Follow the instructions to install it.

For complete description and download :
http://www.speedtech.it/drupal/localizermodule
http://www.speedtech.it/files/localizer_0.0.3.tgz

Roberto Gerola’s picture

Localizer is a module that provides multi-language support.

It uses the locale built-in module and offers the following features :

  • translates the user's menus
  • provides a language switch block
  • translates the node's content
  • supports 2 different types of url for language switching :
    • appending the locale parameter followed by the language : ?locale=en, ?locale=it, ?locale=fr ...
    • creating url alias with the prefix of the country code : it/home, en/ home, fr/home
  • blog listing support
  • taxonomy listing support
  • supports translating of taxonomy terms through locale module (it translates only the terms, you don't have to categorize every localized content with its own, localized, terms)

To offers all these features, some patches to the Drupal core are necessary.
In the package you'll find both the patches and the already patched files.

Future planned features :

  • localization support with locale prefix in the hostname : it.example.com, en.example.com, ...
  • ability to use the locale prefix in the path (it/home, en/home, fr/home) without the necessity to define url alias
  • independent view with all untranslated nodes per language

It can be downloaded here : http://www.speedtech.it/drupal/localizermodule

esord’s picture

Hallo,

I would like to ask one more thing... I tried to use the module about the polls, that comes with drupal, but I am expiriencing some problems... I followed these steps to create a new poll for my site:
1) created a new poll about something in the english language, stored the poll and placed it in the right sidebar
2) I followed the tab about the translations, translated the poll and saved my changes.
3) When I change from one language to the other the poll is translated, and presented perfectly.

The thing is that (I think) when translating the poll we actually created a new node that is assigned to be the translation of the originall poll (please correct me If I have got it wrong....). I voted (let's say in the english translation ) and my vote was succesfully counted about this poll. The results that appear in the front page changed, and I wasn't able to give another vote in this poll (which is very neat if you want your registered users to vote only once per poll).

The thing is that when I switched to the other language my vote was not appearing, and when I logged in I could vote again. I think this is because drupal considers the translation of the originall poll, to be an indipented poll by itself, and does not make the connection between the two polls (originall and translated). Is there someway to overcome this by customizing something? (I am new in Drupal and I don't know if I should have posted this somewhere else, if so could you please give me some directions?)

Thanks again...

Roberto Gerola’s picture

Hi esord.
You're right.

For Drupal the translations are two separated nodes, as if they would be two different polls.
The solution is not translate the polls and patch the polls module to translate the different
items through locale module.

I'll take a look in the next days to see what I can do.

Roberto

millo’s picture

Hi Esord,

Just wondering if you found a solution to running the poll on a multilingual site?

I've got the same issue I posted recently: http://drupal.org/node/85718

Any help appreciated.

Thanks,
Millo

esord’s picture

Hi Millo,

the truth is that I have not come up with a solution yet. The way the multilingual support works right now the two translated polls are considered different polls, so that's why you get different results in the two languages. I tried to translate the poll using the locale module (not to create two different nodes) but the locale module does not translate the body of a node, nor its title, so what I ended up with was a poll block with the title of the block and the button translated in both languages but the content of the block (my poll) only appearing in one language. If I have any news about this I will post it.

Bye..

Roberto Gerola’s picture

Hi.
I'm working on a solution.

Other features of localizer are almost ready :
- support for localization through hostname : it.exmaple.com, en.example.com, and so on.
- new module localizer_news that provides a block with localized news with a dedicated break tag

- new menu expansion and highlight without the nedd of patches to core

Because patching the core modules is not a good solution, I'm trying to move all the features in dedicated
modules.
About pools, after some investigations, I think to create a separate module : localizer_polls, that uses
the same tables of polls and add support for loclaization and permits to select if the results must be shared between
the translations or if each node must have its own results.

I think to provide localizer_polls in the next days.

Bye

--
http://www.speedtech.it

Roberto Gerola’s picture

Hi esord.
I have released the new version (0.0.6) with the poll support.

Let me know if it works for you.

I have also worked on a solution to make the upgrade from a version
to another easier.
Patching is not an option and not all can be done with external modules,
because an overriding of internal functions is necessary for most core
modules.
So I provide already modified modules that will be load instead of the core modules.

Instructions are in README.txt file.

Link to the module :

http://www.speedtech.it/drupal/localizermodule
--
http://www.speedtech.it

esord’s picture

Hi Roberto,

I have just tested the new version (0.0.6) !!! I renamed the poll.module to poll.module.off and placed the new module poll.module that you supply with the new version and went to the administer-> modules page to see if the poll was replaced with the (localizer version). On top of the modules page I got an error about lines 359 and 364 not been supplied with a valid argument.

I added this line (before the first foreach) $node->choice = array_values($node->choice); and changed foreach ($node->choice as $choice) with foreach ($node->choice as $i=>$choice) and the warnigs where gone. After that the polls module works perfectly.!!!

Should I erase the lines I added?

ps->just a small thing for those who use the category module and not the taxonomy module to categorize the content of their site. The taxonomy.module should not be replaced with the one provided because the category module provides its own wrapper for the taxonomy module.

Bye and thanks

Roberto Gerola’s picture

Hi esord.
It is not necessary to place the poll.module file under your modules main directory.
You can leave it under localizer/modules directory and rename the original file.

The bug you have encountered seems to me a little strange.
I'm not able to replicate it.
I didn't touch that function. Perhaps it is called from another function that
I have patched.
I'll investigate further and I'll let you know.

Bye.

--
http://www.speedtech.it

esord’s picture

Hi Roberto,

I was interested in using the events module with the localizer but I had a small difficulty with the appereance of the events. I am using a block month view for the event module (a monthly calendar in a block) and the views that I have enabled are the month and day. If you click on a spesific day the events for that day are presented. If you click on the month you get a view of the month with a small teaser for the events of every day(if you have an event on that day).

I used localizer to translate the events. The event module has a table that keeps time related information for each event that you enter. So the translated events where kept in that table as well. When you saw the events of a specific day (lets say you got only one translated in two languages) you got two times the same event (eg. if you were in english -> two times the english translation). I added a small chunk of code in the event module to fix this.I think that it works with as many languages as you want(at least for the month and day views that I am using) and that the event module will work fine even if you disable the localizer module later.

I will include the code here in case you want to take a look at it ...(it goes In the event.module. Replaced lines 1254 -1256 with the ones that follow. ps->I am not using Localize through hostname)
if(module_exist('localizer')){
$mynodes = array();
foreach($nodes as $node){
if(!in_array($node->nid,$mynodes)){
array_push($mynodes, $node->nid);
$output .= theme('event_node_'. $view, $node);
}}}
else{
foreach($nodes as $node){
$output .= theme('event_node_'. $view, $node);
}}
By doing this I got my events translated and presented only once per language.

manveru’s picture

Do you have any features connected with Views module? I mainly mean adding new filter for language content? And even better setting one view with many languages (for different titles for example).

I have very specific requirements for my site and i18n module does not fill my needs.

Manveru

Roberto Gerola’s picture

Hi.
Integration with Views module is not yet solved.
Yes, the way could be adding a filter option to filter on current language.
I add this to the todo list.

---
http://www.speedtech.it

Roberto Gerola’s picture

Hi.
Today I've released a new version (0.0.5).
Here there is a description of all features :

It uses the locale built-in module and offers the following features :

  • supports 3 different types of url for language switching :
    • through hostname : it.example.com, en.example.com
    • appending the locale parameter followed by the language : ?locale=en, ?locale=it, ?locale=fr ...
    • creating url alias with the prefix of the country code : it/home, en/ home, fr/home
  • provides a language switch block
  • translates the node's content
  • translates the user's menus
  • localized latest posts listing support
  • provides a news block with a new break tag : <!--newsbreak-->
  • blog listing support
  • taxonomy listing support
  • supports translating of taxonomy terms through locale module (it translates only the terms, you don't have to categorize every localized content with its own, localized, terms)

To offers all these features, some patches to the Drupal core are necessary.
In the package you'll find both the patches and the already patched files.
In this new version (0.0.5) : blog, node and menu patches have been removed and the relative features implemented
with different methods, integrated in localizer module and in dependent submodules.

Next planned features :

  • polls support
  • views support
  • taxonomy implementation without patches
  • indipendent view to see all untranslated nodes

Link : http://www.speedtech.it/drupal/localizermodule

--
http://www.speedtech.it

esord’s picture

Hi,

I would like to ask you if you have any advices on how to upgrade from a previous version of the localizer module to the new one. Should we not patch the files again, or should we roll back to the original files and patch those?

Thanks again for your help
esord

Roberto Gerola’s picture

Hi esord.

The simplest way to make an upgrade is to restore the following files to their
original version :

includes/bootstrap.inc
includes/common.inc
includes/menu.inc
modules/node.module
modules/blog.module
modules/taxonomy.module

and then apply my patches again (or overwrite them with the already modified version that I provide) .

If you need additional advice contact me.

Roberto

--
http://www.speedtech.it

scb’s picture

I have just ben testing your module (version 0.0.6 - 2006-10-13), and I think you have to correct something really important.

When you create a node with (let's say) 2 translations, in the node listings 3 copies of the node appear (one for the original, and one for each translation). This is happening because there are three nodes in the database, and any language-unaware query would return all of them.

You should implement hook_db_rewrite_sql, so other queries in all other drupal modules are aware of the language, and just get the nids for the right one (take a look at i18n_db_rewrite_sql()), instead of patching other modules...

For example, in your localizernews module, you would just have to call db_rewrite_sql($sql) instead of that if statement when building the query. By the way, IMO you should remove that news module from the package, as it has nothing to do with localization...

Sergio Caridad - www.artefantastico.com

Roberto Gerola’s picture

Hi Sergio.

>in the node listings 3 copies of the node appear
Yes. I know.
I've tried different way to fix this.
In the version you are using you should simply activate the localizernews method.
It overrides the standard call of /node.

I'll evaluate your suggestion to implement an hook through db_rewrite_sql function.
With this technique perhpas I can avoid a lot patches.

Yes. localizernews should be renamed. I agree with you.
Perhaps with db_reqrite_sql approach I can make it indipendent
from localizer module.

Thank you.

--
http://www.speedtech.it

scb’s picture

Still testing.

I have found that the alias translation problem (i.e. different aliases for each language, for the same node e.g. english: start, spanish: inicio) doesn't work either.
The problem is when you are viewing a node, and switch language, the node switches correctly, but the url stays the same. This will lead to SEO problems, as the same URL will be indexed with different contents. If you try to avoid this by using lang-prepended aliases (e.g. es/inicio - en/start) the language switching does not work.

In my opinion, the main problems with i18n were:
- menu translation (fixed in localizer, also fixed in i18n, I think)
- alias translation (not fixed in localizer either)
- duplicate content (not fixed in localizer either)
- taxonomy duplication (not tried in localizer yet, seems to be fixed)

I think i18n needs a rework, but I think localizer isn't fixing its main problems...

Sergio Caridad - www.artefantastico.com

Roberto Gerola’s picture

> I have found that the alias translation problem doesn't work either
Yes. I know.
I'll investigate further to find a good solution.

> but the url stays the same
Yes, because the URL is created from the menu system, not from the node.
localizer simply translate the node content.

This is a 'problem' of the menu module.
I understand what you mean : when you change language you would that also
menu urls change. I don't think ii is so simple to solve.

I see what I can do.

>using lang-prepended aliases (e.g. es/inicio - en/start) the language switching does not work
Strange. I have never tried to have different language alias, but the locale prefix should work.

For example :
http://www.speedtech.it/it/contact
http://www.speedtech.it/en/contact

You have to define as in i18n two aliases : it/contact and en/contact to make it works.
Yes, I agree that it would be more useful not to define the aliases with the locale
prefix.
Also for this I'll work for a solution.

Thank you very much for you feedback.

--
http://www.speedtech.it

scb’s picture

Thanks for your replies, Roberto.

About the alias thing, making the alias like en/contact - es/contact does work.
It does not work if you actually translate the alias' name (i.e. en/contact - es/contacto)
this would be very useful, as improves readability of urls in all languages, and also very good for SEO.
It is also important if you use the pathauto module.

Thanks for all the effort on making a working internationalization module.

Sergio Caridad - www.artefantastico.com

Roberto Gerola’s picture

In the latest version this should work.
You can use : contact e contacto, without locale prefix.

--
http://www.speedtech.it

XiangXiang’s picture

I've just installed this module to compare with i18n. I haven't used either modules before so as well as Drupal so I'm pretty new to this. I've used MDPro for bi/multi-lingual content sites till now which has core support for that.

What pros/cons does Localizer have compared with i18n? I know it doesn't require patching the core modules. What's more?

Just played abit with Localizer and when I created content I found this:
I want to run an English/Chinese(Simpl) website. Now when I create content for example in English and I don't create a translation for it in Chinese it will only show when you've selected English as Language. I would like to have it show the English entry for it if there's no Chinese entry (and vice versa).
Is this possible already and if not will you make this possible in near future? Maybe with the non-translated entry add a small note that the entry hasn't been translated(yet)

XiangXiang’s picture

I have an issue with the Language Block.
When I install the Localizer module and activate the Language Block it works fine.
But when I change the configuration in settings/localizer the language block dissapears and there's no way I can get it back. Changing theme doesn't work, disabling and re-enabling the block neither. Disabling and enabling the Localizer module fails to solve the problem.

Was able to 'reproduce' this 3 times, by wiping the database and re-installing.
Using Drupal 4.7.4 and Localizer 0.0.6

Roberto Gerola’s picture

Hi.

> But when I change the configuration in settings/localizer the language block dissapears
What changes do you apply ?

--
http://www.speedtech.it

XiangXiang’s picture

"Browser language detection."
When I disable it because it's enabled by default.

PS: What about the language entries?

Roberto Gerola’s picture

Weird.

Under access control, anonymous user has right to access to localizer ?

If, after the change in the configuration section, you go to blocks and save them again,
do you see the block ?

"Browser detection" simply set the default locale based on the user browser.
It has nothing to do with the block language switch.

Do you see some errors or messages that can help the debug ?

--
http://www.speedtech.it

XiangXiang’s picture

I just tried it. I first set that anonymous user has right to localizer module-access localizer.
Then I tried that again, disabling browser detection. And the set language block was gone. I checked the access rights and it was still as it should be.
also the block was still enabled in the blocks admin.

There are not any errors visible

Roberto Gerola’s picture

Have you enabled the locale module ?
Under admin/locale have you enabled the languages that you need ?

--
http://www.speedtech.it

XiangXiang’s picture

Yes, they're all enabled. But once I try that the block is gone.
Could it be something with the new version? 4.7.4?

Roberto Gerola’s picture

> Could it be something with the new version? 4.7.4?
I doubt.
It is difficult to me to help you without seeing the configuration options.

I can prepare a clean Drupal 4.7.4 installation with my module working
and send it to you, complete with a database dump.
Let me know if this can be a viable option for you.
In case, send me an email with a valid email address where I can send to you the package.

Roberto

--
http://www.speedtech.it

Roberto Gerola’s picture

Hi.

> What pros/cons does Localizer have compared with i18n?
There is a pair of comments on my blog about this.
Localizer uses a different approach : it reload the correct node on-the-fly.
i18n selects the correct node through url prefix.

> I know it doesn't require patching the core modules
Yes and no, in sense that to be able to offer some features patching
the core modules is necessary. Instead of patching that can be difficult
for some user, I have included in the archive the complete modified modules.
You have only to deactivate the originals renaming them.
For example for module taxonomy. It is impossible to make it work without patching
the original module.
For other modules, like node, overriding the callbacks function has permitted to not
duplicate it.

> Just played abit with Localizer and when I created content I found this:
Yes. I understand.
I agree with the behaviour that you propose.

I have finished today the localized support for RSS feeds both for news and blog.
I'll work in the next days/weeks to some improvements and I'll add also your
proposal to the list.

Thank you for your feedback.

Roberto

--
http://www.speedtech.it

Roberto Gerola’s picture

Changes :

  1. Added support for localized news (latest post) RSS fee
  2. Added support for localized blog RSS feed
  3. Added support for localized taxonomy RSS feed
  4. Added atom module with support for localized RSS feed

You can download it from here : http://www.speedtech.it/drupal/localizermodule,
or directly from here : http://www.speedtech.it/files/localizer-4.7.0.tgz

--
http://www.speedtech.it

XiangXiang’s picture

great, thanks for the new version. I hope my proposal will be implemented in 0.0.8

PS: e-mail sent

Roberto Gerola’s picture

Changelog of version 0.0.8

  1. Added support for localized paths.
    You can have url aliases like : products (for english) and prodotti (for italian)
    Localizer rewrite all menu paths according with you current locale setting.
    It is not more necessary to prefix the locale code to distinguish the menu items.
    This should be the best SEO friendly implementation, I think.
  2. Added new function : localizer_getlocalizedpath($_path, $_locale)
    Given a path and a locale, returns the translated drupal path
    (the internal path, not the alias. To get the alias you have to use then
    drupal_get_path_alias function).
  3. Fixed localizer_get_destination and localizer_get_localizednid functions.

You can download the latest version from here : http://www.speedtech.it/drupal/localizermodule,
or directly from here : http://www.speedtech.it/files/localizer-4.7.0.tgz
--
http://www.speedtech.it

stf@drupal.org’s picture

I just installed localizer to give it a try (It has quite a reputation out there) but then had to deactivate it again for some reason (which is not important to the problem).

I'm using drupal-4.7.4 and mysql v 14.7 dist 4.1.11
After installing, activating and deactivating localizer
I encountered the following error when trying to access my blog-node:

Fatal error: Call to undefined function: localizer_supported_languages() in /home/path/to/mydrupal/sites/default/modules/localizer/modules/blog.module on line 137

Why doesn't the localizer module replace its versions of blog/taxonomy/poll with their original versions when it is deactivated?

Any hint on how to get my non-localizer version back up and running again?

Thanks a lot
Stefan

Roberto Gerola’s picture

Hi Stefan.

Simply move away from Drupal modules directory the localizer subdirectory.

Let me know if you need additional assistance.

Roberto
--
http://www.speedtech.it

stf@drupal.org’s picture

Hi Roberto,

Thanks for your quick reply!

Unfortunately, this doesn't help at all, on the contrary.
When I move away (or delete) the localizer-subdir my whole site
does not show any article anymore, since the localizer also changes
the taxonomy-module and doesn't deregister this (i.e. let drupal use
the version in the localizer-subdir instead of the original version) either.
Thus drupal is totally messed up because it can not find the taxanomy-module
because the localizer-folder doesn't exist any more.

Do I really have to locate the corresponding entries
(on which xyz.module drupal should use) and correct them manually?

Thanks again!
Stefan

Roberto Gerola’s picture

No.
Simply restore the original versions of taxonomy module under the modules directory of Drupal.
If you have renamed it, rename again to taxonomy.module.
Then go under admin interface, check the taxonomy module and save.

Let me know.

--
http://www.speedtech.it

stf@drupal.org’s picture

Hi Roberto.

I'm sorry, but your comment doesn't help me. There is no version of taxonomy to restore
since I never changed the one in drupal/modules/.
I haven't touch any of the files in my drupal.

Perhaps I am just not making myself clear. I'll try once again:

1. I installed localizer and activated it.
2. I deactivated localizer.
3. From that point on I observe the above error when accessing my blog.

The problem seems to be, that _although I deactivated localizer_ my drupal somehow
tries to use the XYZ.module files located in the localizer-subdir for at least the blog.
As far as I understand it, after deactivating localizer my drupal should just use the
modules located in mydrupal/modules. Instead the above error indicates that drupal is
in fact using the blog.module from

mydrupal/sites/default/modules/localizer/modules/blog.module

and NOT

mydrupal/modules/blog.module

as it should.

If I am being unclear, please let me know and I'll try to be more precise or
rephrase my problem again.

Thanks once again =)

Stefan

Roberto Gerola’s picture

Hi Stefan.
It is clear now.
I thought you had renamed the original versions of Drupal modules.
I am sorry for these problems caused from my module.
I am working in these days to a new version than doesn't touch
Drupal original files, but simply integrate them.

Taxonomy issue is now solved ?
To fix blog issue, try this, please :
- go under modules section, deactivate blog module
- save
- reload modules section
- activate blog module
- save again

Let me know if this solve, otherwise feel free to contact me again,
also privately if you want, and I'll help you to fix this issue on your
environment.

Let me know.

Roberto

--
http://www.speedtech.it

stf@drupal.org’s picture

Hi Robert.

Thank you very much for your effort on my problem in particular
and your work (module/help) here in general.

Unfortunately, the proposed 'solution' to deactivate & reactivate the blog-module didn't help.
I also noted (and did not mention this before) that all the modules that localizer provides
in order to replace their 'original' versions (provided by drupal) are still used. This includes:
- atom
- blog
- poll
- taxonomy
All of them are marked with a '(Localizer version)' in the modules section.
Thus i assume that all of them are used instead of their drupal-counterpart.
Additionally, the original version do NOT appear any longer
(so that I could simply choose which of them to use).

My next best guess is, that somewhere in the drupal-DB of my site
there need to be entries for which modules to use.
The useful ones I found are in the 'system'-table.
(interestingly I didn't find any entry pointing to the original versions
[that provided by drupal]. Does your installation just replace those entries?)
I should thus be able to simply change all occurences of the localizer-modules
back to their drupal original-counterparts.
I just wanted to ask whether this is known to cause problems of any kind or if you
or anyone else has any 'automatic' fix for my original problem.

Thanks in advance!
Stefan

Roberto Gerola’s picture

It is very strange. I have activated and deactivated the modules
in this way many times.
The table that stores this information is system.

Let me know if you can fix your installation in this way.

Roberto
--
http://www.speedtech.it

stf@drupal.org’s picture

Hi Roberto,

first of all I am sorry for my huge delay, work kept me very very busy these days,
but some major projects are done and thus it's getting better now.

I managed to fix my site by correcting the entries for all the modules replaced
by localizer to their 'original' i.e. the drupal version in the system table.
(This should normally be done by localizer itself when deactivated, right?)

As you cannot reproduce the problem I suppose that either I screwed something
up when installing/deactivating or Murphy just hit me in his strange way =)
Anyway, it's fixed now and maybe I'll try the new version ...
(now that I know how to fix it if something breaks)

Thanks again for all your help and keep up the good work!

Cheers,
Stefan

Roberto Gerola’s picture

> This should normally be done by localizer itself when deactivated, right?
No. This system is controlled only by Drupal.

In every case, I have rewritten completely taxonomy support, reintroducing
some patches to taxonomy module that doesn't require localizer module
and are more generic.

I've released version 2 of Localizer, with a lot of significant changes.
In the next hours I'll release a 2.1 version that provides many bugs fixing.

Roberto
--
http://www.speedtech.it

XiangXiang’s picture

I know you're busy working on the initial development of this module for 4.7.x
But do you have a planning in mind for porting it over to Drupal 5?
I am testing 5 Beta 2 right now in a development environment and it's very stable (as far beta's can be) so far. Localizer is my choice for content localisation right now and one for Drupal 5.x is of course very important. I don't know how much changes this would be needed to port it to 5.x since I haven't looked into the Dev Doc for 5.x

Roberto Gerola’s picture

Hi.
Actually the main rewriting is done.
The core features are isolated in the localizer module and I have rewritten
two submodules : localizernode and localizermenu.
I have introduced also a translation system that doesn't use anymore the
locale module, but its own table.

Actually localizermenu and localizernode are completed and working correctly.

I am working now on localizertaxonomy.
I think to make a development release in these days of this new version without taxonomy support,
so perhaps I can receive some feedback.

At the same time I'll begin to prepare the branch for Drupal 5 version.

Roberto
--
http://www.speedtech.it

tadashi-1’s picture

First of all thanks Robert for all the work and the great module so far.

I'm having problems when using this module with front_page however, I wondered if anyone could help.

Front_page setup:

Basically I have one front page set up in the front_page module for all anonymous users.

All authenticated users get redirected to the default front page: www.example.com/node

Localizer setup:

I have 2 languages English and Japanese and the language switch block set up.

Problem:

When I try to switch languages on the front page as an authenticated user, the page reloads but nothing happens. If I then navigate to another page, I see that the language has been changed now. If I switch languages on a page other than the front page and then try to navigate back to the front page, I can't.

When I have www.example.com/node/1 set up as the redirect front page for authenticated users, the behavior is a little different but still strange. Navigation is translated but the language switch block is not updated (the language option doesn't change)

Solution:

?? I guess the problem is with the redirect function. Is there anyway to use this with the localizer module?

Thanks!

Roberto Gerola’s picture

Hi.
It seems to me that you have not patched the core files for caching support.

I have worked in the past days on a solution to remove the need of patching core files.
I am aware of this problem, and I have fixed it in the new version on what I am working.
I have not tested this functionality extensively.
I was glad if you can make some tests on your environment.

Try adding these two functions to you localizer.module file :

function localizer_init() {
global $locale;
if($locale != localizer_getnodelocale($_GET['q']) && drupal_is_front_page() && localizer_existsnodelocale($_GET['q'], $locale)) {
drupal_goto(drupal_get_normal_path(localizer_getlocalizedpath($_GET['q'], $locale)));
}
}

function localizer_existsnodelocale($_path, $_locale) {
$normal_path = drupal_get_normal_path($_path);
$arguments = explode('/', $normal_path);
$node_locale = '';
if($arguments[0]=='node' && is_numeric($arguments[1])) {
$node_pid = db_result(db_query('SELECT pid FROM {localizer} WHERE nid = %d', $arguments[1]));
$node_nid = db_result(db_query("SELECT nid FROM {localizer} WHERE pid = %d ANd locale='%s'", $node_pid, $_locale));
}
if($node_nid) {
return true;
}
else {
return false;
}
}

Let me koow if it is work, I have backported on the fly from my current working environment.

--
http://www.speedtech.it

tadashi-1’s picture

I've added the extra functions to the module but no change unfortunately...

To be honest it's not an urgent problem for me, I can just make some custom made front pages for now, but I'll gladly help you out with any testing.

mohammed76’s picture

hello.

in the i18n module, there's a feature that lets you translate site-wide variables like site_name, site_slogon, etc. is this doable with the localizer module? and if so how?

Mohammed al-shar'

The Explorer

Roberto Gerola’s picture

Hi.
This feature is not yet available, but it will be in the future.
In fact now localizer has its own engine to store and manage every
type of user provided content.

Here : http://groups.drupal.org/node/1827#comment-5328
and here : http://groups.drupal.org/node/1827#comment-5356

you can read what is the idea of this engine.

Roberto

--
http://www.speedtech.it

restyler’s picture

Still no this neccessary feature in Localizer 1.6 for D5? :(

RussianWebStudio: improving the web

tanguillo’s picture

Hi Roberto, nice Work!!! Currently, Im working in a site with a links directory, with a lot of sites in it, so imagine how helpful your module is for me! I dont have to type tons of redirects url's...
But I have one problem... I am making mi directory using the category module. So the structure is something like this:

Paises (Container)
--España (category)
----Link 1 (weblink)
----Link 2 (weblink)
--Italia (category)
----Link 1 (weblink)
--Francia (category)

and so on. The problem is that when I made the translation, it end up like this:

Paises (container)
--country (container)
--España (category)
----Link 1 (weblink)
----Link 2 (weblink)
--Spain (category)
--Italia (category)
----Link 1 (weblink)
--Italy (category)
--Francia (category)
--France (category)

In another words, it duplicates the content, and both categories (spanish and english) are show no matter what is the language select (something not good!).
So, what im doing wrong? Can this problem be fixed?.
Besides that, if I can help you in any way (besides beta-testing), please let me know...
Thanks!

Roberto Gerola’s picture

Hi.
Are you using this module : http://drupal.org/project/category ?

Yes, I think it can easily fixed.

Can I ask you to add an issue to support section (http://drupal.org/project/issues/localizer) ?
It would be of great help for me to maintain the control of requests / bugs / issues.

Thank you

--
http://www.speedtech.it

tanguillo’s picture

That was a fast response!!! Yes, that is exactly the module. The issue is added now. If I can help, please let me know. Thank you!

Sasha B.’s picture

Hi,
is there a way to avoid node duplication when translating a node? I've build a custom node type with fields such us date, price that are not meant to be translated. The problem is, they can be translated - as every version of the node stores its values for date and price. I've tried to separated fields into a table and inner join them on a value of localizer pid but, the problem is I cannot figure out node's pid value when inserting a new node, nor can i find it inside hook_load() (as these assigment probably happen after the node load/insertion..) Man this gives me headache.

Roberto Gerola’s picture

Localizer uses node duplication to translate content.
It is not possible to mix the approach to translate single fields instead.
I think it is a more complex approach.
Here : http://groups.drupal.org/node/1790 there is a discussion and my point of view :
http://groups.drupal.org/node/1790#comment-5262

If you have created your own module, you have the complete control on it.
What I suggest to you :
- when you load your own data, force the data loading form the main node instead of from the current node
- in your form_alter hook, make this fields readonly
- when you save this fields, save them only on the main node

the nid of the main node is the pid in the localizer (or localizernode) table.

Alternatively you can store the data in every node and keep them in sync
when you save your node.

Let me know.
---
http://www.speedtech.it

vb’s picture

Hi, thank you for great module.
But in ver 2.0 there are some bugs, that does not allow use it.

When I add child book translated page, the new item is created.

# Information
# Информация

The book page have assigned path en/info
The translated book page have assigned path ru/info

Language switching shows translation correctly, but new added translated item appears in book tree.

vb’s picture

Cannot create localiser news at all.
The created story does not have assigned english translation and not shown on node with title News or front page.
Checkbox Promoted to front page selected.

Roberto Gerola’s picture

From what I can understand you see all the translated book pages.
It is normal. I must implement the book module support,
Implementing db_rewrite_sql hook.

Please, add this to the issues.

Thank you.
--
http://www.speedtech.it

vb’s picture

Added

The workaround for it.

Simple uncheck Published in Publishing options :)

And how about Localizer News? Should I write an issue too?

Roberto Gerola’s picture

Take a look here, please.

http://drupal.org/node/103675

This new localizernode module should work with every node content
related module.

--
http://www.speedtech.it

vb’s picture

Module from Updates #2

1. Books work.
2. Forum does not work.
3. Stories

School Vacation 30/12/2006-07/01/2007 (this is created story)

* view
* edit
* outline
* translation

Current translations
Language Title Options
Russian Not translated create translation | select node

if I click "select node"

Fatal error: Call to undefined function: db_prefix_table()
in ...\modules\localizer\modules\localizernode.module on line 243

Created news appears on front page and works with translation.

4. A warning message when i click "Recent posts" and Recent posts does not appear

5. When I try to show block Localizer News

Fatal error: Call to undefined function: localizernode_nodenewsteaser()
in ...localizer\modules\localizernode.module on line 343

This is critical bug. There is no return after this to everything.

And I cannot write down a warning message? after "Recent posts" :-)

Waiting for a new release.

Roberto Gerola’s picture

Hi.
I've release a new version. Details here :
http://drupal.org/node/103675 (Update #4)

Let me know.

Thank you for feedback.

--
http://www.speedtech.it

XiangXiang’s picture

When will you release a dev version for Drupal 5 since RC1 of Drupal 5 has been released.
I want to drop 4.7.x and just start with 5.x as the Dev Teams are working very hard, didn't expect a RC so soon...

davidjava’s picture

Hello Roberto, congratulations for your great effort in the Localizer module development!

I installed Drupal 4.7.4 for the first time some weeks ago. I tried to learn quickly trying lots of contributed modules. As localization is one of my main concerns, I installed Localizer 2.1 (I rececenly updated to 2.3).

I think that Localizer is much more powerful than the i18n module in management capabilities. I successfuly translated menus, static pages and taxonomy queries like http://localhost/drupal4/?q=taxonomy/term/11. My problem is that I can not get the terms in the vocabularies translated; they are always shown in English. I suppose they are meant to show translated in the teaser view, the body details view and the create new content page, aren't they?

I applied the patches taxonomy.patch and menu.patch. I checked that all these modules are active: locale, localizer, localizermenu, localizernode, localizertaxonomy, taxonomy. I uninstalled and physically removed the following modules which caused problems: i18n, taxonomybrowser, taxonomymenu. Furthermore, when I query the table localizertranslation I can see the term translations and the value in the object_key field seems correct. What else can I check?

Some help would be appreciated. Best regards.

Roberto Gerola’s picture

Hi.
I've opened an issue with your problem here :
http://drupal.org/node/105789

Discussion will follow there.

I suspect that my patch is missing some pieces.
Can you send me an email with your taxonomy.module file attached
so I can check it ?

Thank you.

--
http://www.speedtech.it

Bodo Maass’s picture

Hi Roberto,

I've been pulling my hairs out for the last few months trying to get i18n to work. While I got it more or less working, i18n still causes lots of little bugs through its internal path translation. For example, it causes some login and logout issues (but only on IE6/7, and only on my webhost, not on my local wamp test install).

Just had another look at localizer and was impressed how much it has evolved recently. Great work. I'm ready to dump i18n. However, I absolutely cannot see how I could work around the views support that i18n provides.
I use panels to contain several views, and they all display the correct localized content. The language of the panel is determined by the url. How would this work in localizer?
To be more specific, I have a list of nodes (such as in a view or forum) and only want to display the ones in the current language. Is this possible in localizer, or should I wait for proper views support?

Best regards and thanks again for your initiative,
Bodo

Roberto Gerola’s picture

Hi.
> I absolutely cannot see how I could work around the views support that i18n provides
Views support is not ready yet in Localizer, but it is the next feature that I'll add in the next days.
(I've received also other requests to implement it).

> I use panels to contain several views, and they all display the correct localized content
A little question. Every panel has the same language or different languages ?

I'll add again the language switch based on url with locale prefix : en/myurl, it/myurl, and so on.
It it useless for nodes for localizer, but it can be useful for views or other types of contents.

In every case, from the requests that I'm receiving, perhaps I should move the localizer
engine towards separating, optionally, interface's language from content's language.

Roberto
--
http://www.speedtech.it

Roberto Gerola’s picture

Hi.
Just uploaded on cvs the changes necessary.
I've updated the localizernode submodule.
You can download it from the following links :

Drupal 4.7.x
http://cvs.drupal.org/viewcvs/*checkout*/drupal/contributions/modules/lo...

Drupal 5.x
http://cvs.drupal.org/viewcvs/*checkout*/drupal/contributions/modules/lo...

Let me know.

Roberto
--
http://www.speedtech.it

Bodo Maass’s picture

>> I use panels to contain several views, and they all display the correct localized content
> A little question. Every panel has the same language or different languages ?

> I'll add again the language switch based on url with locale prefix : en/myurl, it/myurl, and so on.
> It it useless for nodes for localizer, but it can be useful for views or other types of contents.

I use a panel for the frontpage of my site. All views in the panel have the same language, and the language should be determined by the url. Ideally, I'll have www.mypage.com for the english version, and it.mypage.com, de.mypage.com etc. for the localized versions.

I'll give your new views support a try soon.

Thanks,
Bodo

EdInJapan’s picture

Thank you for your superb work!

I downloaded Localizer 4.7.x-2.4 just to look at the instructions to do an upgrade for my test site that is already using one previous version of Localizer. (Not quite ready to jump into the upgrade yet. Besides, I see you have Views support almost ready. I may just wait a bit!)
In the README file under Upgrade, there were two items that I did not quite understand.

 Rename you 'localizer' table to 'localizernode'.
To use you previous translated strings for menu and taxonomy, proper SQL
instructions should be created. 

Is the "table" you are referring to a table in the database? If so, can I just rename this using phpmyadmin?
Is the second part saying that to avoid re-translating menu and taxonomy items, one must manually do some SQL instructions to get them back?

Also, one question not related to the above, normally when a drupal module is updated, we need to run the update.php script. I assume this is true for this new version of Localizer as well?

Roberto Gerola’s picture

Hi Edward.

> Thank you for your superb work!
Thank you very much !

>Is the "table" you are referring to a table in the database?
Exact

> If so, can I just rename this using phpmyadmin?
Yes

>Is the second part saying that to avoid re-translating menu and taxonomy items,
>one must manually do some SQL instructions to get them back?

I've already written the necessary SQL code (http://drupal.org/node/103283) :
RENAME TABLE localizer TO localizernode;

INSERT INTO localizertranslation
(object_key, object_name, object_field, translation, locale)
SELECT m.mid, IF(m.type=115, 'menu', 'menu_item'), 'title', substring( t.translation, 1, 255 ) , t.locale
FROM locales_source s
INNER JOIN locales_target t ON s.lid = t.lid
INNER JOIN menu m ON substring( s.source, 1, 255 ) = m.title
WHERE m.type IN (115,118) AND substring( t.translation, 1, 255 )<>'';

INSERT INTO localizertranslation
(object_key, object_name, object_field, translation, locale)
SELECT td.tid, 'taxonomy_term', 'name', substring( t.translation, 1, 255 ) , t.locale
FROM locales_source s
INNER JOIN locales_target t ON s.lid = t.lid
INNER JOIN term_data td ON substring( s.source, 1, 255 ) = td.name
WHERE substring( t.translation, 1, 255 )<>'';

INSERT INTO localizertranslation
(object_key, object_name, object_field, translation, locale)
SELECT v.vid, 'taxonomy_vocabulary', 'name', substring( t.translation, 1, 255 ) , t.locale
FROM locales_source s
INNER JOIN locales_target t ON s.lid = t.lid
INNER JOIN vocabulary v ON substring( s.source, 1, 255 ) = v.name
WHERE substring( t.translation, 1, 255 )<>'';

> normally when a drupal module is updated, we need to run the update.php script.
> I assume this is true for this new version of Localizer as well?
Yes. It should be so, but the changes involved in Localizer where so many and so
deep, that I was a bit hesitant to make the changes on the db in an automatic way.
Added these instructions on the online manual :
http://drupal.org/node/107677/

Let me know if you need support for the upgrade.

Roberto
--
http://www.speedtech.it

EdInJapan’s picture

Roberto,
Thank you for the instructions. I did the update today, and everything seems to have worked as expected.

After overwriting my old Localizer files with the new ones, I pulled up the drupal mySQL database using phpMyAdmin, went to the SQL tap and pasted in your SQL code. I did originally get an SQL error saying that "localizernode already exists", but am not 100% that it wasn't my own mistake -- possibly hit the apply button twice or something.

For clarity, let me say that I did not already have translated taxonomy, so my test site did not test this portion, but all my old translated content came over just fine, and the minor annoyances about UI selection have all been fixed. Fantastic!

I really like the new feature about being able to see multiple language nodes at the same time. What I did is to create one user for when I want to be in "multilingual mode" (i.e. when I am translating) so that I can see language posts together. Then I have a separate user set up for myself when I am really just browsing in my preferred language. This is great! Thanks so much for your continuing hard work.

leeaston’s picture

I'm brand new to drupal and could do with a bit of hand holding if someone has the time. I've installed D5 and the localizer module and after reading up on localizer I'm still don't know how to use it. Is there a tutorial out there that explain the basics? I'm just after a high level how to create a page in english and french and have a way to switch the site menu from one language to the other and have the page available.

Thanks very much
Lee

EdInJapan’s picture

I don't know of a "basic tutorial", but maybe I can help you out with a few pointers. (Based on drupal 4.7.x)

1. Install Drupal according to it's own instructions. Make sure it is working correctly.
2. Logon as the site administrator. In "administer", go to "modules" and enable the "locale" module. (Make sure to save your settings.)
3. Then in "administer", go to "localization". Click the "import" tab. Read the instructions there. Get your .po file for the language you need. You can do that from the drupal translations page, or in some cases it will be from the local drupal site for the language. Once you have the .po file, browse to it so that the path get put in the appropriate field. Then select the language to import into (French in your case eh?). Now, if this is your first time doing the import, make sure you have the radio button checked for "Strings in the uploaded file replace existing ones, new ones are added". THEN click the "Import" button.
4. Now go back to "administer">"localization", and your new language should be listed. Just to try it out, select it as the default and save the configuration. Your site should change to your new language. For safety, change the default back to English before going on.
5. Now install Localizer according to it's own instructions.
6. In "administer", go to "modules" and enable all Localizer related stuff. (There may be several modules to enable, depending on your version.)
7. In "administer", go to "settings">"localizer" and tweak Localizer settings as you see fit.
8. In "administer", go to "blocks" and select the "Select Language" block. (There may be other language-oriented blocks you might want to activate as well, but you at least need this one.) Remember to click "Save block". You may want to do some configuring while you are there as well.
9. OK. At this point you should have a block that allows you to switch between UI languages. Check it to make sure it works.
10. Now, with your site in English, create some content--let's stick with "page" for right now. As you can see, you have a drop down menu for language. Type your content, and leave it English. Submit.
11. On the page you get when your submission was accepted, you will see a tab for translations. Do your French translation there!

I hope this gets you started.

leeaston’s picture

Thank you for writing that out for me, it's a big help.

I'm on a fresh install of D5 with your latest module installed. I've looked at your site to see how "select content languages" and "select Language" work. It looks like "select content languages" switches the content language and leaves navigation etc alone and "select Language" switches the navigation language while respecting the "select content languages" setting. Well for some reason it doesn't work like that on my test site, changing "select content languages" seems to switch "select Language" and change the content language.

The errors below cropped up during my testing:

call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '' was given in includes/form.inc on line 217.

warning: Missing argument 2 for localizernode_form() in sites/all/modules/localizer/modules/localizernode.module on line 210.

leeaston’s picture

Being new here I don't really know where to post this stuff, please let me know if it should be going somewhere else.

warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in sites/all/modules/localizer/localizer.module on line 697.

I got this after i deleted my 2 test nodes/menu and refreshed the site. The error appeared on the public site of the site.

Aleet’s picture

Hello Ed, thanks for your concise and to-the-point summary. And many thanks to the developer and his continued support!

I checked the demo at http://www.speedtech.it/it/home

If I am correct, the two links on the top are for changing the UI and the bottom two links are for the content.

But shouldn't these links be combined into just links that switch both the UI and content? Why, for example, would anyone want to switch to English and not keep content in Italian?

I am sorry if this was asked earlier. I tried to read everything but this is a pretty long page.

ali

Roberto Gerola’s picture

You don't have to use the content languages block.
You can, but you are not obliged to.

You can use only ui language to switch also the content, simply don't specify
a content locale(s).

Roberto
--
http://www.speedtech.it

EdInJapan’s picture

As Roberto said ever so humbly, Localizer is great because you can have it any way you want. (If you don't want all the menus that perform the choices, don't activate them.)

I am sure that in most cases, when a person visits a multi-lingual site, that particular person will only speak one language, and only want the UI in one language and only want to see content in that same language. As Roberto has pointed out, that is one "normal" way that Localizer can work.
However, Roberto's site is showing off a brand new feature, which I haven't seen in another multi-lingual capable php-based CMS before. Let me give you an example of why this flexibility is useful.

Often, multilingual sites actually have "postings" in only one language or another, but there is a hodgepodge of different postings, some in one language, others in another, and some in both. My family site (when I finally get it running) will be that way. My side of my family only speaks English, whereas my wife's side only speaks Japanese. Each may only use one language for UI and Contents. But there are a few of us (including me) in the group that speak both. For us, we want to see ALL the posts that are available no matter what language. In the past, that would mean switching between UIs, and then looking at what "shows up". Now, I can stay in my preferred UI (English), but see all the posts regardless of language.

Also, if I am a translator, this provides an easy way to "see" what has already been translated.

For multi-linguals, this feature is actually pretty great.

leeaston’s picture

Hi Ed, I feel a bit silly, in my previous reply I mistook you for Roberto! Sorry about that.

I could do with a bit more help if you're up for it. I followed you instructions and had no problems, thing is I don't understand (I've played around for hours and hours) how to get the page and it's translation in to the primary navigation. Any help would be very much appreciated. I could send you the login to my demo site is that would make it easier for you.

Thanks, Lee

EdInJapan’s picture

No problem about the mistake. I wish I was as smart as Roberto.

Anyway, if I understand your issue, you just need to go to administer > menus and make sure the type of content or menu item is enabled.
If you are trying to put a particular page into the menu, then I assume you click the "add menu item" tab at the top of administer > menus. I say I "assume", because I am a drupal newbie too and haven't ever done that.

EdInJapan’s picture

Note that a HOWTO: has now been created. It is based on Drupal 5.x., so there are a few changes from my original "basic tutorial" post above. See the link below for the new documentation:
http://drupal.org/node/114750

Zsoca-M5’s picture

Hi!

I'm pretty new to localizer module (and also drupal), so I think the problem is 'me', but I faced some problems:

I do the following on a new site:

Administer->Site Building->Menus.
Enable Contact and Forum.

Edit both: (Translate them to another language), and select the parent item to "Primary Links".
Submit.
The two "buttons" appears on the top, and now comes the problem.

If I change the language (with the language selection), it changes the language of every item except the buttons of the primary links!

Do I miss something?

Thanks in advance,
Zsoca-M5

thumperstrauss’s picture

I have the same problem. I am newbie, but I've tested the other big translate module, i18n, and it had the same problem. However, there was a workaround. You have to copy and paste the following text at the end of the settings.php file, which should be located in sites/default.

$conf['i18n_variables'] = array(
'contact_form_information',
'site_name',
'slogan',
'menu_primary_menu',
'site_frontpage',
'event',
);

As far as I can tell, the translation modules do an excellent job at letting your translate blocks, menus, pages and stories. But the Primary Links area is programmed in a different way and requires some backend tweaking of code.

I just tried the above code with a minor change to the first line: $conf['localizer_variables'] = array(

I replaced the orignal settings.php with the new one, but it didn't help. If anyone can help us, please do. :(

(By the way, you way have to delete the original settings.php on your server before be allowed to upload a file with the same name in that directory. When you refresh your Drupal site, you will be asked to re-enter your database name, database username and password. Then following the prompts re-set everything to way it was and you'll be back in your Administation screen in a few seconds.)

thumperstrauss’s picture

Update: It now seems like my adding that stuff to the settings.php file worked! The weird part is that the lanaguage Primary Links text stays on the original English while you are working the admin pages. Which is why I assumed that adding that stuff to settings.php didn't work.

But as soon as you click, say, a random page or story, the Primary Links display in the correct language when you switch languages! Woohoo!

For the record, here is what I added to the very end of the settings.php file.

$conf['localizer_variables'] = array(
'contact_form_information',
'site_name',
'slogan',
'menu_primary_menu',
'menu_parent_items',
'site_frontpage',
'advpoll_binary',
'event',
);

Zsoca-M5’s picture

I think you have some other modifications, because I just copied and pasted your code to the very end of my settings.php, and well....nothing happened.
I tried to log out, and click on several other pages, but it does not change the text on the primary links :(

thumperstrauss’s picture

From your original English view, go here:

Administer -- Menus -- Settings

Make sure that "Menu containing primary links:" is set to "Primary links" and click "Save Configuration".

Then click the link for the other language. Now you should the Settings page in the other language.

Make sure that the "Menu containing primary links:" is set to "Liens primaires" or whatever is the other language name of the menu that you should have created earlier. And click "Save Configuration".

Basically, you are telling Drupal that such and such a menu should appear in the reserved spot. Do it from the language view of each language.

Hope that works.

Zsoca-M5’s picture

I tried everything you wrote, but it still doesn't work.

I think I know what is the problem but I can't solve it!

Listen:

In the administer menus part (the List is selected), if I change the Language everything is translated....EXCEPT the primary links!!!! (and the main menu, but that does not make sense now).
So I'm speaking about the TEXT 'Primary links' not the real primary links on the top.

I also tried to delete the whole category 'Primary links', and recreate, translate, and also set at the setting that use this for primary links, but still not working :( (Note: in the settings part if I change the language, than the Text in the combo box also translated at Primary links, but on List view NOT!)

Really interesting.

Waiting for Roberto, for ome feedbacks, about this.

Thanks,
Zs.

Roberto Gerola’s picture

Please, don't use this post anymore. :-)
It has so many comments that it is very difficult for me to follow the threads.

Localizer has its own homepage on Drupal : http://drupal.org/project/localizer
and its own issue queue : http://drupal.org/project/issues/localizer

Open an issue there, so we can find a solution.

Thanks

Roberto

--
http://www.speedtech.it/drupal/localizermodule

mohammed76’s picture

hi, Roberto,

should the ffollowing code work? before I go on troubleshooting why it won't on one site I am doing, I would like it if you could varify

$conf['localizer_variables'] = array(

'site_name',

'site_slogan',
'site_mission',
'site_footer',
'anonymous',

'blog_help',
'story_help',
'contact_form_information',

'user_registration_help',
'user_mail_welcome_subject',
'user_mail_welcome_body',
'user_mail_approval_subject',
'user_mail_approval_body',
'user_mail_pass_subject',
'user_mail_pass_body',
'menu_primary_menu','menu_secondary_menu', );?>

from what I have seen, this is the only one feature that would make it even better than i18n

Mohammed al-shar'

Nattiq Technologies

Mohammed al-shar'

The Explorer

Roberto Gerola’s picture

Please, don't use this post anymore. :-)
It has so many comments that it is very difficult for me to follow the threads.

Localizer has its own homepage on Drupal : http://drupal.org/project/localizer
and its own issue queue : http://drupal.org/project/issues/localizer

The method you are following cannot work because it lacks a proper support
from Localizer to translate the variables.

A module for variables support has been already provided by Troy.
I am going to integrate it in these hours.
It will be available in the next release.

Thanks

Roberto

--
http://www.speedtech.it/drupal/localizermodule

XiangXiang’s picture

Freshly installed Drupal 5 and downloaded the Localizer version "5.x-1.x-dev 2007-Jan-24"
After installing it's all fine, but when I enable the localizer.block module it breaks the blocks and gives me the following warning:

"user warning: Unknown column 'n.nid' in 'on clause' query: SELECT DISTINCT b.* FROM blocks b LEFT JOIN blocks_roles r ON b.module = r.module AND b.delta = r.delta LEFT JOIN localizernode loc ON loc.nid=n.nid WHERE (loc.locale IN ('','-') OR loc.locale IS NULL) AND ( b.theme = 'garland' AND b.status = 1 AND (r.rid IN (2) OR r.rid IS NULL) ) ORDER BY b.region, b.weight, b.module in /www/includes/database.mysql.inc on line 167."

It's a clean install and I used the patched files that came in the tar.

EDIT: Been fixed with patched files issued by Roberto.

k3vin’s picture

I got this error after i click the link "Uncategorized nodes".

"user warning: Unknown column 'n.nid' in 'on clause' query: SELECT COUNT(*) FROM (SELECT n.*, r.tid FROM node n LEFT JOIN term_node r ON r.nid = n.nid) a LEFT JOIN localizernode loc ON loc.nid=n.nid WHERE (loc.locale IN ('de','-') OR loc.locale IS NULL) AND ( ISNULL(a.tid) ) in ...."

thumperstrauss’s picture

I thought I had this module figured out, but I now I'm hopelessly confused about the correct way to enter menus and content (pages, stories).

Can you confirm where the mistake is in this process:

1. Add menu
2. Enter Title ("Cars")
3. Expand 'Translations' and enter title in English ("Cars") and French ("Autos")
4. Submit
5. Click Blocks
6. Change setting of 'Cars' to 'left sidebar' so it will become visible once I assign stories/pages to it
7. Click Create content
8. Click Story
9. Keep Locale set to English
10. In Menu settings, enter Tires in title box; select Cars from Parent item drop-down
11. Submit
12. [The menu title Cars now appears in the left sidebar with the bulleted item Tires underneath]
13. Click Translations
14. Click Create translation
15. [The UI sidebars stay English, by the way]
16. Keep locale set to French
17. Change Title and Body content as desired
18. In Menu settings, enter Pneus in the title box
19. [Here is where I think something has gone wrong... why isn't Autos visible?]
20. In the Parent item drop-down, the French menu item "Autos" is not visible... only the English menu names are visible.
21. So, I leave 'Navigation' as the selected Parent item drop-down
22. Submit
23. Go to front page by clicking logo

Now, when I click the English button to view my site in English, I see the menu "Cars" and the story "Tires" in the left sidebar. But then I click the French button and I see the same exact thing! Not good.

24. From English site, click Tires
25. Click Edit
26. Scroll to the Menu settings and click a *new* link that wasn't there before called 'edit the advanced settings'
27. Expand the Translations links and enter into English title the following: Tires-advancedmenu
28. Enter into French title the following: Pneus-advancedmenu
29. [I don't touch the path, which is node/43 by the way]
30. [Also, I don't touch the Parent item, which is Cars]
31. Submit
32. Go to front page

Now, when I click the English button, the left sidebar menu says 'Cars' and the item below is 'Tires-advancedmenu' (which is node/43). When I click the French button, the menu says 'Cars' (which is still English) but at least now the item below says 'Pneus-advancedmenu' (which is node/44).

The links works perfectly and I see the correct info on those pages. Great! Buy why isn't the menu title appearing correctly? Let's go back Administer - Menus and try to figure it out.

From the Menu -- List, the menu title 'Cars' and item 'Tires' appears regardless of whether I view the page in English or French.

From the English display of Menu -- List

33. Click Edit (under Cars)
34. Expand the translation titles
35. Enter in English title: Cars (translationmenu)
36. Enter in French title: Autos (translationmenu)
37. Submit
38. Go to front page

Now, when I click the English button, the left sidebar menu says 'Cars (translationmenu)' and the item below is still 'Tires-advancedmenu' (which is node/43). When I click the French button, the menu says 'Autos (advancedmenu)' and the item below still says 'Tires-advancedmenu' (which is node/44).

So, it now appears to work. I get the results I wanted. But I have several questions:

1. Why isn't the 'edit the advanced settings' visible when creating the text in the first place?
2. When I first create the menu and specific the languages (from the expand section), why doesn't the system remember this... I am forced to re-enter after creating my first pages (stories).
3. Is something wrong with my installation of this? Is it supposed to work this way?

Roberto Gerola’s picture

At now, you can properly translate menu items only in Menu management interface, not in the page.
So, you can insert only one menu for every group of translations.

I'm working to fix also this.
Be patient, I cannot work more than so :-).

Keep an eye here : http://drupal.org/project/issues/localizer
instead of on this thread.

Thanks.

Roberto

--
http://www.speedtech.it/drupal/localizermodule

arnekolja’s picture

Hi there,

I am wondering how I could create multilingual content. With the menu entries it works, i click advanced settings and have some entry forms for all my languages then. But when editing the content itself I have a small dropdown list for the settings, that doesn't seem to do anything. It's no javascript attached to change the boxes on the fly and when I save with lang1 selected once and then with lang2 selected the second it's always only the last saved version available. I am changing the language with manually placed index.php?locale=my links atm, but with the official locale switcher block its been the same.

Roberto Gerola’s picture

For every language you have to create a separate page with the translated content.
Click on the tab "Translations" at the top.

--
http://drupal.org/project/issues/localizer

mlemayil’s picture

Hello Roberto

I would like to install localizer as my primary links for a bilingual Spanish/English site isn't working (www.cumbredemigrantes.org) and would like to make the site more fully bilingual (we are having a formal event where actually a lot of latin american migrant leaders living in Italy are coming actually)

Anyway as a newbee - do you think I can do it? I also have set up a number of forums that are classified as spanish or english forums under the i18 module. How does your module work with the forums.

I ask because I am about to put a lot of content up so I want to install it before so I have a good multilingual site going but I don't have the skills to spend more than a couple days trying to fingure outall the kinks. I was going to try it today and tomorrow - no chance you'll be around if I have problems?

Mary Beth

MOROZ-1’s picture

Great module ... thanks for it. Really great work.

I have small trouble with taxonomy term (all other things work perfectly).

1. I've created new menu and it translation - works perfectry
2. I've created a new Page and it translation and assigned its menu to the new nenu (then i've made translation on the nemu settings page) - works perfectry
3. I've created new vocabulary called AAA and new term called BBB (and i've translated this term for examplle to CCC)
4. I've created the submenu called "LANG1" and translated it to "LANG2" and assigned it to BBB term ("taxonomy/term/4")
6. i've created another page called TEST1 in one language and TEST2 in another and assigned it to term BBB

My situation:

When i shitch language all menu have correct titles. When i click LANG1(LANG2) item in the menu i see TEST1 article in one language and TEST2 article in another. BUT I ALWAYS SEE BBB TITLE OF THE TERM. AND EXPECT TO SEE CCC. what i am doing wrong?

i am newbee to drupal probably there is the solution sonewhere in this thread by i did'n find it.

My system DRUPAL 5.1 + localizer-5.x-1.7.tar.gz + XaMpp

tky’s picture

I have the same problem with MOROZ, ie couldn't see the translation of the taxonomy terms.
And the terms of the nodes which been translated wouldn't change by the different locales.
How this problem happen?

TKY

wickus’s picture

Hi,

Forget about this message. I got a bit panicked because I had a total mess in my translation to be shown, was kinda mixed up everything.

But one question I have, why can't I translate module strings like 'Select content languages' it won't show up in the manage strings search.

Thank you very much for your help. And keep up the great work.

Mario

thumperstrauss’s picture

I think you're having the same problem I had.

The answer is to select the correct radio buttons on the Home » Administer » Site configuration page. Try selecting the "English (provided by Drupal)" and then do your search. I discovered that this searches a different part of Drupal than searching with "All languages" selected. Good luck.

halotron’s picture

How about listing the available languages as categories for the blog?
A kind of fake categories so to speak.

The reason is that I'd like to specify language in a blogg post. Or are there a better way, which probably will work with common desktop blogg software?

/Jonas
www.joyofbits.se

nanotalk’s picture

Hi drupalist fellow..

How to detect which language is used by a certain node?

Thanks in advance,

--
Nano Surbakti

forgestik’s picture

Hi

I just finished installing the Localizer. It went fine except maybe for 1 thing.

I tried to apply the patches (block menu and taxonomy modules) using gnuwin32. However, I'm not anywhere near to be smart enough just to understand their programmer's manual.

Would someone be kind enough to provide me with the latest version of these patch files? When I compared the file dates, I noticed that the taxonomy.module file provided in the patch directory included with the Localizer package was older than the one in my Drupal module directory.

Thanks
Charles

forgestik’s picture

Why em I on this impression that I'm making a mistake by installing localizer instead of i18n ??

Roberto, are you sure about your choices. I'm buiding up a brand new nutshell.

I read in the documentation that comes with release 1.8 that we no longer need to activate the core taxonomy module in order to use your system. Then why did I spend so much time learning to apply the patch over this module ??

Are you stuck in your development? About to change your mind to later come back with i18n maybe?

forgestik’s picture

I just noticed that these two contribs weren't even written by the same person..??

Count me out. I go back to i18n

jeppius’s picture

Hi nanotalk, did you receive any answer? I also need to know the active language in a node to let my javascript code display different strings to the page.
Any hints?

Kyriel’s picture

Hi Roberto,
I'm receiving a fatal error when I click on 'new translation'.

this is the error I get:
Fatal error: Cannot use object of type stdClass as array in /var/www/html/gospelmessengers/modules/localizer/localizer.module on line 1215

I just downloaded the latest localizer ( localizer 5.x-1.8 )
I would love to find out how to fix this, thanks!

Anonymous’s picture

Hi guys,

Please have a look at this problem of mine; can't proceed. Node: http://drupal.org/node/139306.

Cheers,
Henk

megg’s picture

hi there,

first of all, tnx for the great module. i'm using drupal 5.1 and i _was_ using localizer 1.7, but have since updated to 1.9 to try to fix this problem. however, i'm still having the same problem, so i thought i'd post here to see if anyone can help. i've searched the site and cannot find anyone with the same problem.

i have experienced no problems except for the localizer block. i create one block with the locale 'french' and another with the locale 'english' and place them both in the right sidebar. when i view them on the site, however, i can see them both on the english and french versions of the site. so it's as if there is no localizer at all on the blocks. the localizer blocks module is enabled and i'm not getting any errors.

can someone please help? i'm hoping this is a very simple (human error?) problem...

thanks in advance,
meg
:)

EdInJapan’s picture

I have found the same issue with Localizer 1.9 and the May 4 2007 version of 5.x-1.x-dev. However, I have noticed that if I change my theme to Blue Marine, the problem goes away. (I want to use Aberdeen liquid or Barron, but for both of these BOTH language blocks show.)

This may mean that the issue is not with Localizer, but with themes not using some API correctly, etc. In any case, Roberto, the developer of Localizer, has asked that we not use this old forum for trouble posts, but instead post to the Localizer issues page at http://drupal.org/node/add/project-issue/localizer/bug. I will do this and reference your post as well.

EdInJapan’s picture

This is just to close the loop on this bug. Roberto fixed it as of the 11MAY2007 version of 5.x-1.x-dev release, also known as version 1.9.1 in the readme file. If you already have version 1.9 installed, just overwrite it with this dev release and it should take care of everything.

EdInJapan’s picture

Sorry. Double post due to browser time out.

megg’s picture

thanks, edinjapan, i will follow the conversation over there! :)

nimazuk’s picture

As everyone says, Localizer Module is very powerful!
But how can I change a theme when user changes the site language from Localizer Block?

For example for English & Italian site uses "GARLAND" theme and for Persian site uses "GARLAD_RTL" theme.
How can Localizer switch between themes in different languages?
I couldn’t find a way to do that!

Nima

estebandido’s picture

I have localizer install fine, but when I try to translate my menu items, they change randomly from one language to the other. More than once, I've thought I had it fixed for one and gone on to the next, only to have the previous one break again. The nodes themselves are consistently wrong, no matter how many times I try to change them.

drupalina’s picture

just subscribing

joan llobera’s picture

I've had this bug each time i've tried to delete my pages. Is this a bug of the localizer module? Thanks,

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: DELETE FROM localizernode WHERE nid= in mydrupalhome/includes/database.mysql.inc on line 172.

I don't know at all if it's that but I'm using localizer with nice url's,

johnfyoung’s picture

I'm getting the same thing here:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: DELETE FROM localizernode WHERE nid= in /home/lifelong/public_html/includes/database.mysql.inc on line 172.

Any thoughts?

---------------------
jray - Poulsbo, WA

johnfyoung’s picture

in localizer/models/localizernode.php, line 76
db_query('DELETE FROM {localizernode} WHERE nid=' . $uid);
should be
db_query('DELETE FROM {localizernode} WHERE nid=' . $nid);

---------------------
jray - Poulsbo, WA

goliathcapital’s picture

this module has no support anymore.

karinha’s picture

Hello,

I've been trying to fix this problem for some time now and I think I'm finally on the right track. Since ever I installed update status module, I received a blank white page anytime I was trying to access any of the admin pages (I had posted a thread about this issue here: http://drupal.org/node/662974). Well now, i finally figured out how to turn on the error messages and although I still don't receive any errors on the blank page appearing, I receive this error message when trying to access settings.php:

Warning: include_once(sites/all/modules/localizer/localizer_settings.php): failed to open stream: No such file or directory in .../sites/default/settings.php on line 167 Warning: include_once(): Failed opening 'sites/all/modules/localizer/localizer_settings.php' for inclusion (include_path='.:/hsphere/shared/apache/libexec/php5ext/php/') in ...sites/default/settings.php on line 167

So i suppose, the problem is the localizer module? I tried commenting out the last line (line 167) in my settings.php file, but this doesn't do the trick and now I want to uninstall the localizer module, but I can not do it the regular way, because I can't access my admin pages and i don't only want to delete the localizer folder... I doubt that this would be the proper way to approach this issue, so i would like to turn the module off in the database, but am lost about how to do this; i've seen three tables concerning the localizer module. could anybody please help me out fix this issue?

Thank you in advance,

Karinha

karinha’s picture

I just found the answer myself... about uninstalling the module directly on the database, so i turned the localizer module's status on 0, but it dod not fix the issu eneither. i don't know anymore where to look... :'( Please help!

EdInJapan’s picture

I am not exactly sure how to solve your issue, but maybe you can try the following. (Note that I am not the developer, but use localizer on an older site of mine.) Although I have labeled these 1,2,3 below, they are all separate things to try.

1. The first thing to do is check to make sure the changes to settings.php (your commenting out line 167) really happened. Later incarnations of drupal set permissions to settings.php so that it cannot be changed (444), and most graphical interfaces where you might do editing never tell you that the change didn't "take". Open your current settings.php file to make sure the line is in fact commented out.

2. Do you still have localizer installed in sites/all/modules/localizer or have your already forcefully? If not, put it back in there. Maybe if you can just get everything in the proper paths, it will work long enough for your to do the proper uninstall.

3. It appears that the reason for the error in the first place is that you are using php version 5 and the php files are getting "sent" to the php5 functions. I don't remember for sure, but I don't think either drupal 5 or localizer were written with php 5 in mind. Is there a way you can change your host to use php 4 temporarily so that the "sending" doesn't take place? Maybe this can get you out of the error temporarily so you can uninstall localizer properly.

Hope something here helps.

karinha’s picture

Thank you for your reply. I fixed the issue myself in the meantime - am back on track :)