Recent Topics

[2.4.0RC2] Skin Installation problem with UTF-8 localization

Started by on Feb 22, 2008 – Contents updated: Feb 22, 2008

Feb 22, 2008 05:19    

Version: Venetian (2.4.0-RC2)

I have a skin installation problem that seems to related to the UTF-8 localization and skin process.

The localization, a translated zh_CN_utf-8, is being created by myself, and works fine in many other areas. But when going to the tab of "Skin Install" for the global setting, an error message of "Parse error: Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in (..)/inc/_core/ui/results/_results.class.php(1172): eval()'d code in line 1.

(..) stands for paths omitted.

If I removed the _global.php in the locales folder prior installing a new skin, the error message would disappear. And I was able to install new skins downloaded from the web. Then I could restore the _global.php after that. Newly installed skins seem to be able to be used by the users via blog setting.

Feb 22, 2008 20:50

Hi guizi6,

I looked into this problem with the information you provided. Of course I don't have the translation and if I did, I wouldn't be able to read it. But your description of the problem gave some clues to go after.
This is the snippet that causes the warning / error. I added line numbers:

1163			foreach( $this->cols as $col )
1164			{ // For each column:
1165
1166				// COL START:
1167				$this->display_col_start();
1168
1169				// Contents to output:
1170				$output = $this->parse_col_content( $col['td'] );
1171				#pre_dump( '{'.$output.'}' );
1172				eval( "echo '$output';" );
1173
1174				// COL START:
1175				$this->display_col_end();
1176			}


I removed the pound sign (#) from line 1171 so I had a look at the page in debug mode. There are a few strings that are in the translation files.
The error T_CONSTANT_ENCAPSED_STRING means there is some text in quotes (either single or double) that shouldn't be inside quotes.
I think you want to turn off the translation, view the page, note the English taxt and find that text within the translation. Now watch carefully for any quotes (single or double) within the zh_CH translation. If you find them, remove.

I hope this helps you find the problem.

Good luck

Feb 22, 2008 22:54

Hi, Afwas,

You resolved my problem, although I am still puzzled.

I should added that the error was reported in the column of "Action", for each row listed.

With your trick, I first identified the troubled string which turns out as the "Del" translation as shown below as in the messages.po file.

#. TRANS: Abbrev. for Delete (stats)
#: ..\..\..\conf\_icons.php:99
#: ..\..\..\conf\_icons.php:306
#: ..\..\..\inc\sessions\views\_stats_direct.view.php:63
msgid "Del"

I noticed that the translated string, which does not contain a quote in it, somehow mysterously becomes a string containing a single quote under the debug mode. I am not sure if this is due to the character-set swaping.

However, this same icon and the translation related to it apparently is also used in other screen, such as Regional (Setting) screen. And there is no problem found under other cases.

At any way, the quick solution I am using right now is changing the translation. And then it works charmingly.

Thanks a thousand! You have a nice weekend.

Feb 22, 2008 23:13

hi guizi6,

Nice you solved the problem.
I more or less expected what you described: the translated text is still not displayed in the charset that it is supposed to be displayed. Unfortunately this is an internal thing from B2evo and we cannot fix it at the moment. Note that the phpBB forum we are using here has exactly the same problem - the text in the posts is correct but not the post in the titles.

Happu blogging

Mar 05, 2008 23:47

Hi, Afwas,

I have another question related to the "view" in the skin and translation.

I notice that the word of "No views", "1 view", "%d views" has been hardcoded in the program, possibly _item.class.php. Meanwhile, there are no translation "placeholders" for those three defined in the messages.po file. Therefore, the returned string is displayed as is.

My quesiton is, how can this be fixed so that this data can be displayed with the localized labels.

Thanks.

Mar 06, 2008 00:10

Inc/Items/Model/_item.class.php lines 2543 - 2573:

	function get_views( $zero = '#', $one = '#', $more = '#' )
	{
		if( !$this->views )
		{
			$r = ( $zero == '#' ? T_( 'No views' ) : $zero );
		}
		elseif( $this->views == 1 )
		{
			$r = ( $one == '#' ? T_( '1 view' ) : $one );
		}
		else
		{
			$r = ( $more == '#' ? T_( '%d views' ) : $more );
		}

		return str_replace( '%d', $this->views, $r );
	}


Lines 7090 - 7094 - 7099 in the German .po file. It is in all translation files in the package for B2evo 2.4.

Do have another look.

Good luck

Mar 06, 2008 03:34

Thanks Afwas for pointing me to the direction! After reading your message, I just went back and re-searched the messages.po file I am working on, and found all three placeholders are all there!

I guess I was looking for "views" at first. But when I found out there should be three strings, I forgot to go back to messages.po and look again. Sorry for this stupid question.


Form is loading...

b2evo – This forum is powered by b2evolution CMS, a complete engine for your website.