1 (edited by ssb 2005-03-10 10:32)

Topic: Question to Rickard

Rickard,
I'm working on admin control panel multilanguage support and need some advice.
Is it preferable to use a single language file for the whole administration or use multiple files, same way forum works ?
There are many strings, common to all tasks. Messages like "Yes" "No" "Save" "Delete" etc. Currently i put them in a adm_common.php language file.
The rest messages are stored in multiple files, one per admin task. For example...

admin_categories.php uses adm_categories.php lang file and $lang_adm_categories array

I've started mod using stable 1.2.2 Do you think i should follow 1.3 tree ?

I'd appreciate any comments
Thanks

Sakis is my name, ssb just a nick.

Re: Question to Rickard

Dividing it up into a few smaller files is probably a good idea. You could even create a directory in the language pack for admin files. I recommend that you follow the 1.3 tree. If this will make it in, it will be in 1.3.

I think a lot of people will appreciate a localizable admin interface. What I don't like about it, and this applies to language packs in general, is that is limits what I can do without breaking compability with already released language packs.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Question to Rickard

My 2 cents suggestion : it's the "job" of the people doing the localization to keep up. If something change, they should change it in the localization. If something isn't there for the translation, use the english by default, that should be fine for anybody. I do it that way for Textpattern, and it's not hard at all (well TXP is hard to translate because of the lack of context, but you thought of that for PunBB smile ).

My 0.5 cents : a single file for each language would be much more easier I think...

Re: Question to Rickard

maybe you could do something like lang('common','Forum') for text with the first bit being the language section and the second being the text then do

function lang($file, $text)
{
    return isset($lang[$file][$text]) ? $lang[$file][$text] : $text;
}

that way things will work although they will be displayed in english if they are not in the language pack

Re: Question to Rickard

Jérémie: I agree. The problem is that people don't keep up. That means I have to get in touch with them. Regarding one of more files, I really don't care. The reason I split it up for the existing language packs was performance. Including a huge language file can take a while.

Connorhd: True. However, that approach would incur the overhead of a function call every time a piece of text is to be displayed.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Question to Rickard

yeh i dunno how bad that is

Re: Question to Rickard

About the one file : maybe you could put the localization in the DB ? Load it from a file (to ease translation, management and so on), but when it's done all call are made to the DB. It should be faster than including a php file, no ?

About the keep up : I haven't been here long enough to say, but from my fresh point of view the multiples files are an issue to keep up. For example, there is a french up to date pack (I think). I disagress seriously with several choices of translation, so I want to edit it. We (french) have the chance of having the languages files in a wiki at punbb.fr, so I already corrected most of it.

But for the remaining ones (including banning HTML entities; and using only utf8 ? which by the way could be tricky since it's PHP file, not text... I don't know, I will see when I try it) I have to check a dozen files, correcting, re-encoding, checking the choices I've made in others files to stay coherent, and so on.

So I would make this "new pack" avalaible if anyone is interested, and I will certainly keep-up to the new PunBB versions when I update my own forum(s), but it will mean more maintenance, more work from me, and more work for the people interested. In the end, it could explain why some poeple make their owns mods on their own and don't share.

Well, with SVN I maybe could create a patch for it (I don't know if I can limit the scope of a SVN patch, to not include others modifications or hacks I've down elsewheres), but most people are afraid of SVN and won't use it.

Re: Question to Rickard

I'm not sure how placing language packs in the database would make anything easier. Also, I'm positive it would be slower, not faster.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Question to Rickard

i think putting them in the database is a really bad idea its a huge amount of stuff to put in the database for little advantages

10

Re: Question to Rickard

I've updated to latest 1.3 dev and included all mods i did so far.
Almost 50% is done. I think, early next week it will be ready.

Sakis is my name, ssb just a nick.

11 (edited by ssb 2005-03-12 12:18)

Re: Question to Rickard

There are so many strings common in forum and admin CP !
I really don't know what to do with them. Do you think is better use already assigned ones in forum language or reassign them in an admin-only language file ?

For example, terms like forum, admin, go back, save, user, username, post etc., plus many error messages already exist in lang files used by forum itself.

Reassigning them in an admin CP specific language file is easier, because there is no need to include forum lang files and gives more freedom in translation, but... (there is always a ...but smile )

Any suggestion Rickard ?

Sakis is my name, ssb just a nick.

Re: Question to Rickard

Well, I would use everything possible from $lang_common (which is included in common.php anyway). Other than that, I think i would keep the rest in the admin language files.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

13 (edited by ssb 2005-03-12 15:17)

Re: Question to Rickard

Hmm $lang_common includes only a few of those common strings. Most of the rest are in other lang sources.
For now, i don't use them at'all, saving all admin cp strings in adm_xxxx.php files. IMHO that makes it easier for anyone to include admin localization.
The only minor problem is that there will be some duplicate entries, i mean strings found in both forum and ACP lang files. Not big deal though... It can be fixed in a future revision if is necessary.

Thanks anyway smile

Sakis is my name, ssb just a nick.