From: Magnus E. <ma...@he...> - 2002-03-18 09:43:56
|
Hi all! I'm developing for norwegian speaking users and need to make the sites in norwegian, but I see error messages and other small messages like this in the source code (from base_user::NewUser.pm): my $error_msg = 'Could not create user in database. Error has ' . 'been logged and administrator contacted.'; I was thinking, can we do something like this: my $error_msg = OpenInteract::Translate->error('msg' => 'Could not create user ?1?, because ?2?', '1' => "$username", '2' => "$foo"); (you probably want to change class/method name and tokens, but that's another matter;-) The error method simply substitutes ?1? with $username and ?2? with $foo and falls thru if the user wants english. If not it replaces it with the translated version, like this: 1.First check if it's cached in the module I reckon we could save some db hits this way. Maybe we'll have to limit the cache size though, so we don't eat too much. Maybe we should do some cache ageing too? 2.If it's not in the module, check the database See my proposed db layout bellow. Maybe we should do it in a file instead? I feel like db, but don't know why;-) Add the translation to the cache in the module. 3.If it's not in the database, add it If we can't find it, we add the english version to the db and tell an admin, (s)he will then see an untranslated line in the webinterface. This way all new erros in new versions of a package gets added, and we can translate as they come. The idea is to make it flexible... 4.Use english as backup language We already have the original message, so we can use that. Maybe some people would prefer a backup response in their language instead. What I think we need/issues: - Webinterface, to use for translating and uploading already translated errors (in a file) - A way to share tranlations easy - It should be very little extra work for developers, maybe my proposed syntax is a bit too long? - Timestamp error messages, so that messages in old packages we don't use anymore can be discarded - Larger language field in the sys_user table, we have 4 languages in Norway.. (Only two in popular use though) Proposed db layout: CREATE TABLE error_msg { error_msg_id %%INCREMENT%%, error_msg text, last_used timestamp, primary key (error_msg_id) }; CREATE TABLE error_msg_translated { error_msg_id %%INCREMENT_TYPE%%, language char(4), error_msg text, primary key (error_msg_id,language) }; I haven't started coding this yet, I would like your feedback first... Chris: How would you like me to make patches for you, if you want to add it in the offical code? (I've never made a patch before ;-) Bertelsmann.de guys: Did you do anything like this when translating to german? MVH/Best regards -- Magnus Espeland ma...@in... |