Drupal taxonomy terms language depending - why nodes in all languages are visible? - drupal-7

What I want to acheive:
I have multilingual site (i18n module).
I have vocabulary named "brands" - terms of vocabulary don't need to be translated because they are the same in all languages.
I've also nodes that I can assign to languages and "brands".
In taxonomy - in multilingual options - I set this vocabulary to: Localize. Terms are common for all languages, but their name and description may be localized.
Now - the problem is - that when I enter from menu to "brands" and e.g. "volvo" in any language - list of all nodes (all translations in different languages) is shown.
I'd like to see only the nodes in language that is set.
I have other vocabulary - where terms should be translated also. I have set it to Translate. Different terms will be allowed for each language and they can be translated. and there everything works fine - depending on language.
How to acheive that with my first vocabulary?
Thank you for any suggestions.

I have set the vocabulary to Translate. Different terms will be allowed for each language and they can be translated. and duplicated each brand for each language and then updated each node - with setting term for particular language.
In my opinion this is workaround, but I couldn't find other solution.

Related

Generate english versions of same content on Drupal?

My website needs to be able to support multiple languages for multiple countries. For example, the US might have English and Spanish, while the UK might only have English. If two countries use the same language, it DOES NOT mean the content is the same.
For this reason, I decided to use the internationalization module (i18n) and I created language codes as follows:
gb-en - UK English
us-en - US English
us-es - US Spanish
I set this up with no issues, but my problem comes in with creating all the default content. For each content type, I want to:
Set the content types default language as "English"
Create translated versions of each content type for each language
I know this will mean that the Spanish content would still be in English, but it's the first step towards translating it.
What is the easiest way to create all these "default" content pages?
You could create a module implementing hook_node_insert(). This module would intercept the creation of a new node (stored with the default language) and create as many copies as needed. Each of these copies should have a different value in the field language. These copies colud be easily stored in the dabase using node_save() function.

drupal 7 taxonomy i18n is not working when editing multilingual content.I'm stock to default language

I create a taxonomy called colors.
Each of my term are translatable, in french and english.
I create a content type called product where I can associate a taxonomy color. Note that my product content type is multilingual aswell
My admin default language is french.
When I create a product,the color taxonomy is only showing in french which is my admin default language. In my mind, it's supose to be displayed within the language set in the node.
It's a problem right now because, english node is associated to french taxonomy.
Anybody know how can I resolve this issue.
Thanks a lot.
It depends on how your taxonomy was set up.
There are three different modes, beside from no-multilingual:
Localize. Terms are common for all languages, but their name and description may be localized.
Translate. Different terms will be allowed for each language and they can be translated.
Fixed Language. Terms will have a global language and they will only show up for pages in that language.
I guess colors are common for all languages, so I would recommend using the first option.
You can then translate the colors via config > translate interface.
When you chose the "localize" option you don't have duplicate colors showing up on node forms.
Update
If the terms are common for all languages but you want to add more fields to the terms, you could use localize and in addition use the entity translation module.
Entity translation allows you to translate the different fields for each term.
There are two drawbacks though:
On top of the entity translation you have to translate the terms via translate interface or else the terms will not be translated on the node-edit-forms.
You have to alter the aliases for the Terms yourself via /admin/config/search/path so the terms have different path aliases for different languages
This is of course not a good solution for user-generated terms but works if the terms are moderated.

Multiple phrases per language in cakephp

I am creating a website using CakePHP that requires translation not only into multiple languages but also multiple phrases per language depending on the type of the logged in user. This will allow the same functionality but with more formal or more friendly language without duplication.
As a very simple example:
Type 1: "Customer", "purchase","shopping cart"
Type 2: "Client", "buy", "basket"
Type 3: "User", "order","invoice"
Each of these types would be available in multiple languages.
I've got the standard localization working in CakePHP (one of the reasons I chose it!) and have the appropriate default.po files in the /Locale/[lang]/LC_MESSAGES/ directory and all is working fine there (thank you to the user who noted on this site that ger needed to be deu to work ;) ).
Before I get too far into the app I'd like to add the phrasing so I can set e.g. the language as French and phrasing as type2. If I was doing this outside of a framework I'd have a matrix look-up to find the correct string based on language and phrase keys but am unsure of how to do this within CakePHP's localization.
Currently I'm using the standard __([string]) convention but as this is early in the development cycle it would be trivial to change if necessary.
I was considering using __d([phrase],[string]) but can't see how to set this without creating my app as a plugin and then I'm back to the same problem with /Locale/
I have been unable to find any example of this in my searches on SO or the cakePHP community sites so would be grateful for any suggestions.
Is there a standard way to do this within cakePHP? if not, what would be a good "best practice" way to implement this?
Edit - following the answer below here's how it was implemented:
in /app/Locale/[lang]/LC_MESSAGES/ I created a new .po files with the new phrasing in them as phrase1.po, phrase2.po etc.
Where I set the language I also set the phrasing where the phrase file matches the name of the po file:
Configure::write('Config.language', 'deu');
Configure::write('App.langDomain', 'phrase1');
and all strings were wrapped with:
__d(Configure::read('App.langDomain', 'string')
And it just works.
Use __d() like this:
__d(Configure::read('App.langDomain'), 'Some string');
In bootstrap.php check the conditions and set App.langDomain based on whatever you need.
__d() has nothing to do with plugins, you can use it everywhere.
And alternative would be to wrap your translations with a custom method, something like
__dd(Configure::read('App.langDomain'), array('foo' => __('String1', 'bar' => __('String2'));
The array is an array of langDomain => stringForThatDomain mappings. Your __dd() method would take the one that is passed in the first argument.

How to setup Drupal multi language site?

I was searched and read many websites but can't find how to set up drupal multi language website.
I want to use 2 languages in a site.
These 2 languages have different content. (not content translation).
I had enabled Locale module, enabled multilingual support in each content type
but when i was added content in 2 languages
the front page list all of those articles without filter the site's language.
how to setup drupal 7 to list articles with filtered language.
eg:
http://example.com/en <- this url should list all english article.
http://example.com/fr <- this url should list all france article.
I have to install i18n or Internationalization module from Drupal contributed modules and enabled these option.
Multilingual select
Internationalization
** This module require Variable module.
Since the content is different, one way to achieve this is by creating two different content types. Assign an alias pattern to each content type like en/[node:title] and fr/[node:title]. You can then display each or both content types on any page; it could be a taxonomy page with alias en or fr. If you choose this method you won't need locale. This one is not intended for translated sites where each content has a matching translated content.
If you also want to expand some special words which have not include in language lib, you can try following code:
$zh = variable_get('locale_custom_strings_zh-hans');//zh-hans is your language key.
$zh["More news"] = '更多信息'; // KEY/VALUE
variable_set('locale_custom_strings_zh-hans',$zh); // set it back.

Sitecore country ISO in url

I have created a site with multiple languages in sitecore... I the content editor (system > languages) I have specified three languages (Dutch, English and German). No I have 2 problems.
When an item has, for example: an English version but no German and Dutch version and I type the address to the German site: www.testsite.com/de I get the German site, but without content. In this case I want a 404 page to be shown.
Another problem is when I go to language that is not specified in system > language and also on the item is still get an empty site. In this case I also want a 404 page to be shown. Sitecore shows the page as long as it is a valid ISO-code.
I'm using Sitecore 6.4
Does anybody has a solution for these problem(s)?
Thanks in advance!
mrtentje
My LinkManager is specified as follows in the Web.config:
<add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="true" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="asNeeded" languageLocation="filePath" shortenUrls="true" useDisplayName="false"/>
Unfortunately you have to manage both of these scenarios manually in Sitecore, they both have quite simple solutions but will require some development on your part.
For the first (accessing of pages without translations) I think you would need to extend the current ItemResolver within Sitecore and have it explicitly check that a version exists for the language that has been selected. I haven't implemented that myself but that's how I'd look at handling it.
The second (only accepting certain languages) is something I have handled, and it really bothered me that Sitecore couldn't handle it itself (though perhaps it does and I missed it). For this I created a step in the pipeline immediately after the LanguageResolver called PermissableLanguageChecker. This checks to see if the current language of the request is one of certain allowable values, and if it isn't it sets the language back to the default language, or in your case throw a 404.
For the "allowable values", I read them from the site config with a new property there:
<site name="website" ... permissableLanguages="pl-PL,en" language="pl-PL" ... />
That permissableLanguages property is handy as we can also use it later on in the site when presenting a language selection control to the user.
You may want to take a look at the Language Fallback module in the Sitecore Shared Source Library. As it covers some of your scenarios.
http://trac.sitecore.net/LanguageFallback

Resources