I have a string (in use by views) but I can not translate it. locale says unsupported html.

Comments

oriol_e9g’s picture

Probably it's a problem with a module that are not using the t() function with the "Any" string.

You have to localize the string in the code... or give us more clues :D

What modules are you using? Where/When appear the string?

bwynants’s picture

nope, that's not the problem. In de code the string uses t(). I can translate it but I can not use the '<' and '>' symbols in the translation.

(it is a string from an exposed filter of views)

oriol_e9g’s picture

Could you try yo use this?

&lt; instead of <
&gt; instead of >

&lt;Any&gt; instead of <Any>

I think that could be a problem with HTML filter.

bwynants’s picture

then it shows up as &lt ;Any&gt ; in the UI....

pwolanin’s picture

This sounds like a bug with Views - why is it wrapping something in a pseudo-tag?

cezio’s picture

StatusFileSize
new2.85 KB

Moving away '<'/'>' from translated strings will help. I've made a patch for Views 6.x-2.2 to fix t() function calls with those pseudotags.

oriol_e9g’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 6.x-dev » 6.x-2.x-dev
Component: locale.module » Code
Status: Active » Needs review

For me it's fine.

merlinofchaos’s picture

Status: Needs review » Needs work

It's in a place where we're not placing HTML. Apparently locale can't tell the difference. :/

This patch completely fails my style check -- It conforms neither to the Drupal 6 nor Drupal 7 usage of the . operator. (I conform to the Drupal 7 use of the . operator and always have).

thepanz’s picture

@merlinofchaos : I try to provide a patch, but something strange happened: some files I try to edit:

1. views_handler_filter.inc
2. admin.inc

Have a MAC lines encoding instead of UNIX, so my patch will interpret the whole file as changed.
The files that includes these "pseudotags" are:

1. views_handler_filter.inc
2. admin.inc
3. views_plugin_style.inc

all committed by you (the third file have a Windows line-endings) If out have a fix for this encoding issue I can provide a patch for these replacements:

t('<Any>') to '<'. t('Any') .'>'
t('<None>') to '<'. t('None') .'>'
t('<All>') to '<'. t('All') .'>'

Maybe you can find-replace these occurrences..

Regards

thepanz’s picture

Component: Code » User interface
Priority: Normal » Critical

These pseudo-tags couldn't be translated neither using Drupal builtin translation tool or importing a .po file: pseudo-tags get removed and not inserted into translation table. Moving to Critical and to "User Interface".

Any help?

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new4.29 KB

mh here i could create the patch without problems.

sure the wronge filendings has to be solved, but this should be in another issue.

thepanz’s picture

Status: Needs review » Needs work

Your patch fails on "includes/admin.inc" and in "hadlers/views_handler_filter.inc" (maybe for the MAC line-endings commented before)

Regards

merlinofchaos’s picture

Status: Needs work » Closed (won't fix)

I see no reason to bother. You can switch from <Any> to - Any - which *is* translatable in the settings. This doesn't affect existing installs.

eddy147’s picture

Thx merlinofchaos for the tip. I just switched to "- Any -" via Views > Tools.

But why keep t('<Any>') in the code if it isn't translatable?

merlinofchaos’s picture

Priority: Critical » Normal
Status: Closed (won't fix) » Active

Well, ok, you got me on the useless t() call.

merlinofchaos’s picture

Patches accepted. This should be an easy one.

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new1.26 KB

Here is a patch which changes the pot file too.

merlinofchaos’s picture

Status: Needs review » Fixed

Fixed in all 6.x branches -- this appears to already be done in 7.x

Status: Fixed » Closed (fixed)

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

castawaybcn’s picture

are you sure it is fixed? I am running 6.x-2.8 and the issue persists...

castawaybcn’s picture

forget about my previous post, I just found the answer here http://drupal.org/node/663156
sorry about the trouble

lmjabreu’s picture

Version: 6.x-2.x-dev » 6.x-2.8
Priority: Normal » Critical
Status: Closed (fixed) » Active

Same here, the problem still persists, and I've checked the option in Tools.

dawehner’s picture

Priority: Critical » Normal
Status: Active » Fixed

You cannot translate - Any - ?

I don't think so

Status: Fixed » Closed (fixed)

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

eldblz’s picture

Status: Closed (fixed) » Needs review

Hi,

i've currently set the option in Views -> tools to "- Any -" but i still can't translate it

Edit: FIXED: apparently you must type exactly "- Any -" (case sensitive).

eldblz’s picture

Status: Needs review » Closed (fixed)

Closed thanks.

mikou’s picture

In file views_handler_filter.inc
Line 469 should be
$any_label = variable_get('views_exposed_filter_any_label', 'old_any') == 'old_any' ? t('<Any>') : t('- Any -');
instead of
$any_label = variable_get('views_exposed_filter_any_label', 'old_any') == 'old_any' ? '<Any>' : t('- Any -');

This change worked for me.

Michsk’s picture

#27: thanks.

Aldus’s picture

Status: Closed (fixed) » Active

Sorry to re-open old stuff, but I still can't translate it.
Tried to convert from to - Any - , then went in translate interface, in "String contains" I put: Any, - Any -, etc. but always I get:

No strings found for your search.

"- Any -" guess? :)

dawehner’s picture

If you set ''- Any -' for the any text you can find it.
Search for "Any" and you will find the string sooner or later.

iamjon’s picture

Status: Active » Closed (fixed)

Changing status.

Anonymous’s picture

Version: 6.x-2.8 » 6.x-3.x-dev
Component: User interface » Translations
Status: Closed (fixed) » Active

My apologies for opening this back up, but I'm unable to translate "Any" following the instructions above. I've done it before on other sites using other versions of Views, but the current version I'm using doesn't seem to want me to do it. I've done everything to the letter (as with the sites where it has worked), and yet searching for "Any" or even "ny" doesn't pull anything up. Thank you in advance for any light you may be able to shed on this difficulty I'm having.

tarmstrong’s picture

john-foland:

Go to /admin/build/views/tools and the last item should be a configuration option where you can select '' or '- Any -'. Choose the latter if you wish it to be picked up by t() and translated.

The option is labeled thus: 'Label for "Any" value on optional single-select exposed filters :'

tarmstrong’s picture

john-foland: Additionally, if you're attempting to translate it into French, "- Any -" isn't included in the translations file.

dawehner’s picture

Status: Active » Fixed

@tarmstrong provided a solution.

Status: Fixed » Closed (fixed)

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

arun_ispg’s picture

By default in view 6.x-2.12 there is no t() for "<Any>" in views_handler_filter.inc. By adding t() function there the issue will solve.