Problems with 1st Internationalization effort

A place for users and developers of the Xataface to discuss and receive support.

Problems with 1st Internationalization effort

Postby jonbfl » Thu Aug 25, 2011 9:10 am

Hello everyone --

I'm working on making my first internationalized pilot. I got _auth working with no need to call home, LOL (hooray) -- But I'm stumped on what is wrong here -

I first modified my database -- I cloned its model with MySQL Workbench, and changed all the character sets to UTF-8_general-ci and collation sequences to match, then added the translation tables for Authors and Quotations. I synched that model into a newly created database. I used the Xataface installer to create a new application. I extracted it, added the templates_c folder and fixed it's permissions. OK! The new application (without modification to conf.ini) displays the blank database correctly and is functional.

I added the lang folder and changed its owner. I then made these changes to the conf.ini to attempt to get the translations working. Its drawing a blank, literally. Index.php, when refreshed, is an empty set. I thought it might be a parse error with the unquoted en=English; didn't matter -- en="English" also draws a blank.


;;Configuration settings for application
multilingual_content=1
default_oe=UTF-8
default_ie=UTF-8
title="quotations_ml"
[_database]
host="localhost"
name="quotations_ml"
user="root"
password="xyz123"

[_tables]
authors = "Authors"
authors_en = "Authors En"
authors_es = "Authors Es"
contributors = "Contributors"
quotations = "Quotations"
quotations_en = "Quotations En"
quotations_es = "Quotations Es"
users = "Users"
[languages]
en=English
es="español castellano"

PHP version = 5.3.5,
I looked and I am not getting any logged PHP errors since I made the changes. (it has been logging prior errors, so I know its working). Error Level = 'error_reporting = E_STRICT' :shock:

thanks for any input
8)
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm

Re: Problems with 1st Internationalization effort

Postby shannah » Thu Aug 25, 2011 10:05 am

I'm on the road so can't say too much now.

1. -lang=en
2. Don't list your translation tables in _tables. Xf picks them up automatcally.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problems with 1st Internationalization effort

Postby shannah » Thu Aug 25, 2011 10:08 am

Also notable. Translation tables shouldn't have auto increment columns. I sometimes make that mistake when initially copying schema from default table.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problems with 1st Internationalization effort

Postby jonbfl » Fri Aug 26, 2011 8:06 am

Dear Steve:

Thanks for the tips - I had indeed missed the "auto increment" thing on the primary index of the language files. However, like the other steps you suggested, that made no difference.

Through a process of fixy, test, fixy, test, fix again, plus a second installation on a different server, and using XF 1.27 as well, it is down to "it breaks when I add 'multilingual_content = 1' to the conf.ini file". Everything works fine up to that point.

I tried to debug = 1 in the conf.ini, but it never gets off the ground, so no debug.

I'm going to confess that I may be the cause of the problem (aren't we always). I'll describe what I'm trying to do, why I want to do that, and what I may have ignored/overlooked/missed.

The current state of our project is that we're trying to build our 'select' tables and metadata for the application I'm working on. We're also developing the language for static text for the end user interface at a later date.

To develop the data entry application, I need basically a two/four language lexicon. The project leader and I are both bilingual in English and Spanish. The other team members are all fluent in Spanish. For table building, all I really need are the English and Spanish field labels, the English/Spanish existing translations, and to have the interface language selection to work. I don't need customized static content, we just want to enter our codes, their terminology in each of the four languages, and an agreed-upon definition in English/Spanish. We really only need the interface to 'work' in two languages at this point. I will accept that in order to get the translation scheme to work, I will probably have to make it so I have four languages in the lang folder (.en,.es.,.eu,.fr). My plan/was is to copy the Spanish es.ini to the basque (undefined) eu.ini language file. As we get down the road, we will be happy to contribute a Basque language file.

After a bit of thought, I think I understand that the primary key in the default language will be written to the primary key of the translated field in each of the available languages. I imagine when you click on the translate button, a new record/row will be inserted in the target language table with the same primary key value as the master record.

Based on my understanding of how Xataface internationalization works, I should be able to use these tables as the basis for our 'select' vocabulary.

My guess as to what is wrong (at the moment) is that I am have not provided translatable templates. How am I doing???

Is there a way to bypass creating translated templates? If not, what is the simplest route to wind up with a working application.

I'm actually secretly hoping that I have done something really stupid that does not require translating all the templates, but rather having Steve chuckle at my naiveté.

Thanks very much for all your help. I continue to be amazed at the flexibility of this tool.

:D
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm

Re: Problems with 1st Internationalization effort

Postby shannah » Fri Aug 26, 2011 3:57 pm

I'm not sure I fully understand what you are trying to do. If you only need to translate the interface (and not the database content) then you don't need the translation tables nor the multilingual_content=1 option in the conf.ini file. All you need to do is specify the languages in the conf.ini file and provide language INI files to the translation options.

E.g. field labels can all be internationalized in the language .ini files. And most templates are already internationalized using the {translate} tag.

This tutorial covers it:
http://xataface.com/documentation/tutor ... taface-0.6
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problems with 1st Internationalization effort

Postby jonbfl » Mon Aug 29, 2011 1:59 pm

Hi Steve

Actually I have been following that tutorial. I was not as clear as I should have been, I guess. We want to use the translation functionality. It is our intent to have the 'text' content available in four languages, and having the built-in structure for that during editing is my one of my top reasons for adopting Xataface.

In order to eliminate any chance that my cloning of the working database was part of the problem, I updated my working database being careful to follow your comments, and the tutorials. To further reduce error chances I chose to only translate one field in my quotations table, the quotation_text field.

At the moment I have two languages; 'en' and 'es'

I read your comments about translations, and reviewed the en.ini and es.ini files, they seem OK. I interpret your comments to mean that no further translation editing of the language .ini files should be needed to use Xataface with the templates as they are. (I'm only trying to get it working so I can demonstrate the functions, then figure out if we need any changes to start data entry.)

Here's what I have done:

I added tables quotations_en and quotations_es to my database

Image

the conf.ini
;
Code: Select all
;Configuration settings for application
multilingual_content=1
title="quotations_base"
default_oe=UTF-8
default_ie=UTF-8
[_database]
   host="localhost"
   name="quotations_base"
   user="root"
   password="12345678"
   
[_tables]
authors = "Authors"
quotations = "Quotations"
users = "Users"
contributors = "Contributors"
[languages]
en=English
es="español castellano"
[_auth]
users_table = users
username_column = user_nick
password_column = user_password


I have the two language files in the /lang folder.

The application works correctly, and displays the language selector, the labels switch language correctly.

As soon as I add multilingual_content=1 to the conf.ini, Xataface stops outputting. So I imagine I'm actually getting an error.

This is the only actual error logged today:
[29-Aug-2011 17:46:54] PHP Strict Standards: Non-static method Dataface_Installer::authenticate() should not be called statically in /opt/lampp/htdocs/xataface/installer.php on line 502

I hope this is a bit clearer.

Thanks very much
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm

Re: Problems with 1st Internationalization effort

Postby jonbfl » Mon Aug 29, 2011 8:04 pm

OK I made some progress:

I changed my error reporting level to error_reporting = E_ALL & ~E_NOTICE

that drew this error:

Warning: require_once(Dataface/QueryTranslator.php) [function.require-once]: failed to open stream: No such file or directory in /opt/lampp/htdocs/xataface/config.inc.php on line 246

Fatal error: require_once() [function.require]: Failed opening required 'Dataface/QueryTranslator.php' (include_path='.:/opt/lampp/htdocs/xataface:/opt/lampp/htdocs/xataface/lib:/opt/lampp/lib/php') in /opt/lampp/htdocs/xataface/config.inc.php on line 246

I looked through the two working versions I had; 1.2.7 and 1.3rc6 for a QueryTranslator.php - no luck. Also checked the archive downloads and sample apps.


:?:
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm

Re: Problems with 1st Internationalization effort

Postby shannah » Wed Aug 31, 2011 7:13 pm

For some reason the QueryTranslator I guess isn't in the distribution. Just get it from SVN.
http://weblite.ca/svn/dataface/core/tru ... slator.php

Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problems with 1st Internationalization effort

Postby jonbfl » Thu Sep 01, 2011 11:00 am

Ok, great

Thanks very much!

:D
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm

Re: Problems with 1st Internationalization effort

Postby jonbfl » Sat Sep 03, 2011 1:21 pm

Okay - I have the Query Translator in place. "It WORKS" - but I get an error after the translated record is saved.

Fatal error: Call to a member function display() on a non-object in /opt/lampp/htdocs/xataface/Dataface/TranslationForm.php on line 150

This error happens right after I save the translated record.

Image

My database has been trimmed so the only translated field is the Text field to hold the Quotation itself. I also cleared out all earlier data, so everything would be in sync. This way I don't get multiple errors.
Image

I created and saved the record in the Master Language (en) and that record exists.
I then selected the record and used the translate tab, the translation edit appeared correct, and I clicked the 'save button'.

The record was not actually saved - in either quotations_en or quotations_es (I got no error however) Both datasets are empty. So, its possible the error really reflects an attempt to use a non-existent object.

Thanks very much
8)
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm

Re: Problems with 1st Internationalization effort

Postby shannah » Sun Sep 04, 2011 9:26 pm

Can you post the schemas (e.g. create table statements) for the quotations, quotations_en, and quotations_es tables?
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problems with 1st Internationalization effort

Postby jonbfl » Tue Sep 06, 2011 11:21 am

Sorry for the delay -

CREATE TABLE IF NOT EXISTS `quotations_base`.`quotations` (
`idquotations` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`quotation_source` VARCHAR(45) CHARACTER SET 'latin1' NOT NULL ,
`quotation_text` MEDIUMTEXT CHARACTER SET 'latin1' NOT NULL ,
`quotation_contributor` VARCHAR(45) CHARACTER SET 'latin1' NOT NULL ,
`author_id` INT(11) NOT NULL ,
`quotation_last_update` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY (`idquotations`, `quotation_source`, `quotation_contributor`, `author_id`, `quotation_last_update`) ,
INDEX `fk_quotations_1` (`author_id` ASC) ,
CONSTRAINT `fk_quotations_1`
FOREIGN KEY (`author_id` )
REFERENCES `quotations_base`.`authors` (`idauthors` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 17
DEFAULT CHARACTER SET = utf8,
COMMENT = 'need to be able to free search'
<-------------------------------------------------->
CREATE TABLE IF NOT EXISTS `quotations_base`.`quotations_en` (
`idquotations` INT(10) UNSIGNED NOT NULL ,
`quotation_text` MEDIUMTEXT NOT NULL ,
PRIMARY KEY (`idquotations`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8,
COMMENT = 'need to be able to free search'
<--------------------------------------------------->
CREATE TABLE IF NOT EXISTS `quotations_base`.`quotations_es` (
`idquotations` INT(10) UNSIGNED NOT NULL ,
`quotation_text` MEDIUMTEXT NOT NULL ,
PRIMARY KEY (`idquotations`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8,
COMMENT = 'need to be able to free search'

Thanks very much
:)
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm

Re: Problems with 1st Internationalization effort

Postby shannah » Tue Sep 06, 2011 11:45 am

Your primary keys must match for each table. You have a compound primary key in the quotations table but not in the other tables. You really don't need a compound primary key at all unless I'm missing something. You should just be using your autoincrement field as your primary key. If you need an additional unique key then you can create additional keys - but the primary key will be guaranteed unique based on just the idquotations field.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problems with 1st Internationalization effort

Postby jonbfl » Tue Sep 06, 2011 1:42 pm

Wow - Thanks Steve!

Its weird, I looked right at that when I posted, and I was thinking about - Why should a foreign key affect things???

Ahh, umm, I wonder how I did that??? :oops: I sure didn't intend it... I'm going to see if I have any more tables like that...

The truly outstanding news from my perspective is that I was able to save the translated field, and when I switched to 'castellano' - there was my translation of the quotation! I suspect you probably can appreciate how happy seeing those few words made me. :D

THANKS A LOT. (now I have to get cracking...)
8)
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 27 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved