View Issue Details

IDProjectCategoryView StatusLast Update
0000163WackoWikilocalizationpublic2019-02-14 12:04
Reporterebal Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status acknowledgedResolutionopen 
Target Version6.1.x 
Summary0000163: database language system
DescriptionAbout the language schema, i believe that we could have something mix
(still only an idea). We can create a php page that parse the database
schema to language files. Some problems are that when a new word is
added to wakka.en.php the translators should every time diff the files
and add the new or if somehow the structure of the file is changed ...
If the language schema is on a database (just an idea - don't shoot :) yet) like the below :

+-----+---------------+---------+-------+
| id | word_variable | english | greek |
| 1 | hello | Hello | Γεια |
| ... | ... | ... | ... |
|9999 | bye | goodbye | αντίο |
+-----+---------------+---------+-------+

every translator could just edit (or re-edit) the database
and run the parser_from_database_to_file.php to create the wakka.*.php
TagsNo tags attached.
Attached Files
mysql.jpg (158,821 bytes)   
mysql.jpg (158,821 bytes)   
wacko.jpg (76,811 bytes)   
wacko.jpg (76,811 bytes)   

Relationships

related to 0000336 acknowledged Have a base language file that the localisation ones can overwrite 
related to 0000130 resolvedadministrator Always return iso-8859-1 
related to 0000216 resolvedadministrator UTF8 support 

Activities

administrator

2008-04-08 15:44

administrator   ~0000312

Tann San:
I like the idea of a database language system, it will save a lot of time with the language updates. We could easily build a page that pulls out the text for every language so we could see which languages need translating. Kind of a developers language debug page. There's already a database page cache system that the wiki uses, we could probably expand that to include the language system. It would make things a lot easier to cope with.

administrator

2008-05-14 20:21

administrator   ~0000326

ebal:
I made some time today to do some work at this.
You know already that i dont like anything else
than utf-8, and i can leave without

http://wackowiki.com/StandartyVerstki

but with this :

http://wackowiki.com/%D1%F2%E0%ED%E4%E0%F0%F2%FB%C2%E5%F0%F1%F2%EA%E8

It doesnt matter much (again is only my opinion)

The generic idea is to transfer the lang/wakka.*.php to a simply
database language scheme, so someday all the lang dir should be a simply
and small function in the wacko class and everything are in one table.

For this reason i created a new table to work with:

CREATE TABLE IF NOT EXISTS `wacko_lang` (
  `id` smallint(5) unsigned NOT NULL auto_increment,
  `str` varchar(40) default NULL,
  `en` text,
  `el` text character set greek,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Description :
id : Is the identifier of the string variable
str : The string variable, according to wakka.en.php is the key of the
$wakkaResource array
en : The string in the $lang, where $lang = en according to
wakka.en.php is the value of the $wakkaResource array
el : The string in the $lang, where $lang = el and is the translated
string in greek

An example is below ( I know that every line i am writing is just
greek-to-you, but is greek to my too :p) :

id | str | en | el
1 | YouAre | You are | Eisai o

( i wrote my translation with english layout - just for you to see the
example)

my lang/wakka.en.php now has only the below code (only 3 lines):

$rs = $this->LoadAll("SELECT str, ".$lang." FROM
".$this->config["table_prefix"]."lang");
foreach ($rs as $value)
  $wakkaResource[ $value['str'] ] = $value[$lang] ;

but the greek translation is in utf-8 so my lang/wakka.el.php has the
below code (5 lines):

mysql_query("SET NAMES 'utf8'");
$rs = $this->LoadAll("SELECT str, ".$lang." FROM
".$this->config["table_prefix"]."lang");
foreach ($rs as $value)
  $wakkaResource[ $value['str'] ] = $value[$lang] ;
mysql_query("SET NAMES 'latin1'");

but i also change the charset from lang.el.php from ISO-8859-7 to UTF-8

I test it a lot (believe when i tell you a lot) and i found more trouble
with some pages in english than in greek !!! When i change the default
lang of a page to el (---> this means the charset is utf-8 from
lang.el.php) every el page seems ok but not every english page. But when
i change the lang.en.php from iso-8859-1 to utf-8 things got a little
better, but not quite all.

I should try to use ISO-8859-7 for greek but ... i should change all the
pages from en to el to see them in my site. Again the encoding of the
wacko is the only thing i dont like (i mean i hate it).

So thats my idea for the database language system more or less.
Every translator should use a new field in wacko_lang to his language
and transfer his translation to the database. I did the el field with
just this code at the end of my old wakka.el.php :

foreach($wakkaResource as $key => $value)
  echo "UPDATE wacko_lang SET el = '".addslashes($value)."' WHERE str =
'".addslashes($key)."' ;" . "
";

And i just copy-paste the results in the database

There should be a check point for every string that hasnt been
translated yet, so the english string should appear instead.

Your thought gentlemen ???

administrator

2008-05-14 20:25

administrator   ~0000327

Tann San:
I am 100% interested in making Wacko totally UTF-8, as far as I know that is already in the bug tracker as a future task. I tried to do this with the new installer I'm writing but it did not work properly. I am going to finish the functionality of the installer first and then go back and make it use UTF-8.

According to this Joomla page:

http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,guidelines:utf-8/

I sent that to Martin the other day. They list the problems they encountered when converting Joomla to be 100% UTF-8 driven. The main problem seems to be that not all PHP string functions are UTF-8 compatible and that the "proper" way to handle it for now is to use the mbstring extension. The problem is that alot of hosts don't support that so we would have to write or find a 3rd party PHP class to handle UTF-8 strings for us.

I don't mind doing this in the version we're working on now although it will more than likely delay it even longer. Might be better in the version after that. The very next version is more of an update whilst the one after it is essentially a major rewrite of the system.

Tann San

2008-05-15 10:54

manager   ~0000328

Last edited: 2008-08-23 13:55

**About the page names**

As long as we handle the PHP utf8 string support in a careful manner then we can have cyrillic domain and page names as well as any others that are non-English alphabet based (i.e. Chinese):

http://www.Γεια.com
http://www.wackowiki.org/Γεια

are both valid domain names and we should support them both.

Tann San

2008-05-15 10:54

manager   ~0000329

...however it appears mantis doesn't like them as links though :¬)

ebal

2008-05-15 18:09

developer   ~0000330

btw the links is in greek not chinese :P

Tann San

2008-05-15 18:42

manager   ~0000331

hehe yer I got that, I meant I was posting examples of cyrillic links but that we could do Chinese as well. I'm really quite keen to implement your system, it seems very short and simple yet the potential of it is great. I'm just nervous that it will break other things which we might not detect until later on.

Freeman

2008-07-01 09:36

developer   ~0000395

Last edited: 2008-07-01 09:56

I not agree that database as language storage is better for end-user. As a tool for translator, maybe. It's easier to use of WinDiff/WinMerge for a single file instead of headache with database updates/deploy.

Second note is about non-English domain names. They must be encoded with IDN syntax: мойдомен.su -> xn--d1acklchcc.su, київ.su -> xn--b1alf1j.su. IDN-compliant browsers like Opera do it automatically. Don't know about PHP.

Freeman

2008-08-10 17:44

developer   ~0000469

Last edited: 2008-08-10 17:46

http://пример.испытание/ or http://παράδειγμα.δοκιμή :)

administrator

2016-07-03 12:34

administrator   ~0000964

from Serge:

"it is almost a miracle - add/delete to english, run
# relang wacko.en.php wacko.??.php
and all set & done

[..]

relang.php is complete language & charset agnostic,
requiring that translation array keys be alphanumeric,
but this is easily fixable
"

https://bitbucket.org/wackowiki/wackowiki-dev/src/tip/community/devel/relang.php?fileviewer=file-view-default

Issue History

Date Modified Username Field Change
2008-04-08 15:41 administrator New Issue
2008-04-08 15:41 administrator Legacy => NEW
2008-04-08 15:44 administrator Note Added: 0000312
2008-04-08 15:44 administrator Reporter administrator => ebal
2008-05-14 20:21 administrator Note Added: 0000326
2008-05-14 20:22 administrator File Added: mysql.jpg
2008-05-14 20:22 administrator File Added: wacko.jpg
2008-05-14 20:25 administrator Note Added: 0000327
2008-05-15 10:54 Tann San Note Added: 0000328
2008-05-15 10:54 Tann San Note Added: 0000329
2008-05-15 18:09 ebal Note Added: 0000330
2008-05-15 18:42 Tann San Note Added: 0000331
2008-05-17 10:29 administrator Target Version => 5.4.0
2008-05-31 23:12 administrator Status new => acknowledged
2008-06-28 16:03 administrator Relationship added related to 0000130
2008-07-01 09:36 Freeman Note Added: 0000395
2008-07-01 09:53 Freeman Note Edited: 0000395
2008-07-01 09:56 Freeman Note Edited: 0000395
2008-08-10 17:44 Freeman Note Added: 0000469
2008-08-10 17:46 Freeman Note Edited: 0000469
2008-08-10 19:39 administrator Relationship added related to 0000216
2008-08-23 13:55 administrator Note Edited: 0000328
2010-03-08 10:16 administrator Category Localization => localization
2011-07-30 07:03 administrator Relationship added related to 0000336
2014-03-21 15:00 administrator Target Version 5.4.0 => 5.5.0
2015-02-19 19:25 administrator Target Version 5.5.0 => 6.1.x
2016-07-03 12:34 administrator Note Added: 0000964
2018-08-06 14:37 administrator Target Version 6.1.x => 5.5.7
2019-01-14 14:22 administrator Target Version 5.5.7 => 5.5.8
2019-02-14 12:04 administrator Target Version 5.5.8 => 6.1.x