Yii Framework Forum: Layout issues when usin Yii:t()... - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Layout issues when usin Yii:t()... Rate Topic: -----

#1 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 01 June 2010 - 09:31 AM

I'm using Yii:t() to translate my website core messages. Pages that have this function instantiated presents one or more line carries not present on the main layout. When I get back to source language the lines disappears.

Anyone has experienced this issue? Am I forgetting some thing?
0

#2 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 647
  • Joined: 29-November 08
  • Location:Paris, France

Posted 01 June 2010 - 01:50 PM

ciao thiagovidal,
I'm afraid I don't understand what your problem is ? Maybe you could provide more details and code sample ?
8)
0

#3 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 01 June 2010 - 02:45 PM

View PostRaoul, on 01 June 2010 - 01:50 PM, said:

ciao thiagovidal,
I'm afraid I don't understand what your problem is ? Maybe you could provide more details and code sample ?
8)


Please see the 2 images attached to know what I mean.

On first image before the translation, there isn't another return space between the page title and the breadcrumbs
on second image you can see that the entire content after breadcrumbs gone down one line.

The code analysed on firefox with firebug show the same code but rendered different after translation.

<div class="container">
	<div id="content">
		<h1>Create new account</h1>


<p>Please fill out the following form to create a new account.</p>


after

<div class="container">
	<div id="content">
		<h1>Criar uma nova conta</h1>


<p>Preencha o formulário a seguir para criar uma nova conta.</p>

<div class="form">

0

#4 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 647
  • Joined: 29-November 08
  • Location:Paris, France

Posted 01 June 2010 - 03:59 PM

hum ... This is strange indeed. I've used translation function yii::t() with no problem so far. Can you post your translation file please ? (located under messages/)
ciao
B)
0

#5 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 01 June 2010 - 04:30 PM

Yeah off-course.
Thank for you interest.

<?php
return array(
	'About'	=>	'Sobre',
	'April'	=>	'Abril',
	'August'	=>	'Agosto',
	'Birthday'	=>	'Data de nascimento',
	'Can not access your account?'	=>	'Não consegue acessar sua conta?',
	'Clear form'	=>	'Apagar formulário',
	'Clear form anyway?'	=>	'Deseja realmente apagar formulário?',
	'Contact'	=>	'Contato',
	'Create new account'	=>	'Criar uma nova conta',
	'Day'	=>	'Dia',
	'December'	=>	'Dezembro',
	'Email'	=>	'Email',
	'February'	=>	'Fevereiro',
	'Fields with <span class="required">*</span> are required.'	=>	'Campos com <span class="required">*</span> são obrigatórios.',
	'First name'	=>	'Primeiro nome',
	'Home'	=>	'Início',
	'Incorrect username or password'	=>	'Nome de  usuário ou senha inválidos',
	'January'	=>	'Janeiro',
	'July'	=>	'Julho',
	'June'	=>	'Junho',
	'Last name'	=>	'Ultimo nome',
	'March'	=>	'Março',
	'May'	=>	'Maio',
	'Month'	=>	'Mês',
	'Name'	=>	'Nome',
	'Names cannot contain numbers or special characters.'	=>	'Nomes não podem conter números ou caracteres especiais.',
	'November'	=>	'Novembro',
	'Password'	=>	'Senha',
	'Password confirmation'	=>	'Confirmação de senha',
	'Please enter the letters as they are shown in the image.'	=>	'Por favor entre a letras como mostrado na imagem.',
	'Please fill out the following form'	=>	'Por favor preencha o formulário a seguir',
	'Please fill out the following form to create a new account.'	=>	'Preencha o formulário a seguir para criar uma nova conta.',
	'Register'	=>	'Registre-se',
	'Registration'	=>	'Registrar',
	'Retrive password'	=>	'Recuperar senha',
	'Secret answer'	=>	'Resposta de segurança',
	'Secret question'	=>	'Questão de segurança',
	'Select one from the list'	=>	'Selecione uma da lista',
	'Send message'	=>	'Enviar mensagem',
	'September'	=>	'Setembro',
	'Sign in'	=>	'Entrar',
	'Sign out'	=>	'Sair',
	'Stay signed in'	=>	'Continuar conectado',
	'Subject'	=>	'Assunto',
	'Thank you'	=>	'Obrigado',
	'Thank you for creating your account. You may now go to login form to enter site.'	=>	'Obrigado por criar sua conta. Você já pode ir para a área de login e acessar sua conta.',
	'Thank you!'	=>	'Obrigado!',
	'This email address already existis in our database.'	=>	'Este endereço de email já existe em nosso banco de dados.',
	'This username already existis.'	=>	'Este usuário ja existe.',
	'to contact us.'	=>	'para enviar sua mensagem.',
	'to create a new account.'	=>	'para criar uma nova conta.',
	'to request a new password.'	=>	'para solicitar uma nova senha.',
	'Username'	=>	'Nome de usuário',
	'Username only can contain letters and numbers.'	=>	'Nomes de usuário só podem conter letras e números.',
	'Username or email'	=>	'Nome de usuário ou email',
	'Verification code'	=>	'Código de verificação',
	'Year'	=>	'Ano',
	'You already have your account. You cannot create a new one. Please go to another page.'	=>	'Você ja possui uma conta. Você não pode criar outra. Por favor acesse outra página.',
	"What is your father's middle name?"	=>	'Qual é o nome do meio do seu pai?',
	'What is your favorite car?'	=>	'Qual é o seu carro favorito?',
	'What is your favorite place on world?'	=>	'Qual é o seu lugar favorito no mundo?',
	"What is your gradmother's middle name?"	=>	'Qual é o nome do meio da sua avó?',
	'What is your library card number?'	=>	'Qual é o número do seu cartão da biblioteca?',
	'What is your primary frequent flyer number?'	=>	'Qual é o número do seu cartão de viagens principal?',
	'What was your first phone number?'	=>	'Qual foi o seu primeiro número de telefone?',
	"What was your first teacher's name?"	=>	'Qual é o nome do seu primeiro professor?',
);


0

#6 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 647
  • Joined: 29-November 08
  • Location:Paris, France

Posted 01 June 2010 - 05:31 PM

I wish I could help you better but right now I have no idea what could cause this problem ! is you message file utf-8 encoded ? The only option I see is you post HTML files for the english and portuguese pages. I'll try (tomorrow) to see why they don't render the same way.
ciao
B)
0

#7 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 01 June 2010 - 07:45 PM

yeahhh... my main config file charset is set to utf-8. I try change this to iso-... but same issue again.
0

#8 User is offline   Theill11 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 03-March 10
  • Location:@ localhost

Posted 02 June 2010 - 12:30 AM

I dont know if this is the same problem, but I experienced something similar.

In one of my view files I had the folllowing:

<?php
/* $this CController */
/* $model CActiveRecord */
?>

<?php
echo $model->name;
?>


The empty line between the codeblocks caused an extra line in my layout when nothing is outputtet in the first codeblock.
0

#9 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 02 June 2010 - 07:13 AM

Maybe is the damned BOM?

Check if the language file is encoded in UTF-8 WITHOUT BOM.

Some editor add this byte that can create problem. Check if the encode of all file is UTF-8 WITHOUT BOM.
0

#10 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 02 June 2010 - 07:40 AM

View Postzaccaria, on 02 June 2010 - 07:13 AM, said:

Maybe is the damned BOM?

Check if the language file is encoded in UTF-8 WITHOUT BOM.

Some editor add this byte that can create problem. Check if the encode of all file is UTF-8 WITHOUT BOM.


I think you are right! But i don't know how to do this... Can u help me?
0

#11 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 02 June 2010 - 08:58 AM

You have to open the file with the editor and check the encoding.

It can be in some menu of the editor, or format menu, or preference->encoding, dipends from the editor.

If is encoded with UTF-8 with BOM change to UTF-8 without BOM
0

#12 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 02 June 2010 - 09:33 AM

hum... not work! Now it's getting worse, my layout is following apart.
0

#13 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 03 June 2010 - 05:37 AM

What do you mean with "following apart"?

If you are part of some unlucky people, wich has not-ascii character in their language, you have to pay attention to:

  • In layout/main.php you should have this line:<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  • All files have to be encoded in utf-8 without BOM
  • In your dbConnection you should have:
    • 'charset' => 'utf8',
    • 'initSQLs'=>array('SET NAMES utf8')


With all this precaution, you should avoid any problem with encoding, your db will be readable and all character displayed in a proper way.
0

#14 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 03 June 2010 - 03:04 PM

View Postzaccaria, on 03 June 2010 - 05:37 AM, said:

What do you mean with "fowling apart"?


Sorry. My mistake. I meant falling apart.

View Postzaccaria, on 03 June 2010 - 05:37 AM, said:

If you are part of some unlucky people, wich has not-ascii character in their language, you have to pay attention to:

  • In layout/main.php you should have this line:<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  • All files have to be encoded in utf-8 without BOM
  • In your dbConnection you should have:
    • 'charset' => 'utf8',
    • 'initSQLs'=>array('SET NAMES utf8')


With all this precaution, you should avoid any problem with encoding, your db will be readable and all character displayed in a proper way.


I did this but still not working. I don't understand. I really believe that is something with page encode.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users