PDA

View Full Version : Solution to translate harcoded tokens in skins (Feature request)



redesb
10-23-2005, 07:05 PM
Hello John,

I think that I have found the definitive solution to the problem to translate 'hardcoded' tokens of skins without making in depth changes in DA.

According to I understand, since to change the binarys of DA it is not a easy option, the solution would have to implement itself modifying only templates and the configuration files

Example of possible solution:

The example is based on the file '... /admin/show_admins.html' but he is extrapolateable to all the archives (and TOKENS) that need it.

Present file ' show_admins.html':

|?TREE=&raquo; <a class=tree
href="/CMD_ADMIN_SHOW">`LANG_SHOW_ADMINS`</a>|
|?HELP_SECTION=`ADMIN_HELPER`/createa.html|
|HTM_ADMIN_TOP|
<a href="HTM_ACCOUNT_ADMIN_CREATE">|LANG_CREATE_ADMIN|</a><br>
<a href="HTM_ACCOUNT_ADMIN_DELETE">|LANG_DELETE_ADMIN|</a><br>

|TABLE|

|HTM_ADMIN_BOTTOM|Suggested change:

|?TREE=&raquo; <a class=tree
href="/CMD_ADMIN_SHOW">`LANG_SHOW_ADMINS`</a>|
|?HELP_SECTION=`ADMIN_HELPER`/createa.html|
|HTM_ADMIN_TOP|
<a href="HTM_ACCOUNT_ADMIN_CREATE">|LANG_CREATE_ADMIN|</a><br>
<a href="HTM_ACCOUNT_ADMIN_DELETE">|LANG_DELETE_ADMIN|</a><br>

|HCT_SHOW_ADMINS_TABLE|

|HTM_ADMIN_BOTTOM|HCT _ = Acronym of HardCoded Token

It would be necessary to add following to the file ' files_admin.conf ':

HCT_SHOW_ADMINS_TABLE=admin/show_admins_table.htmlAnd to create the file 'lang/en/admin/show_admins_table.html' with the
following content:

|TABLE|The 'HCT_ANY_THING_TOKEN' it is what there would be to add to DA and it would always aim at the directory of the language selected by the user.

This way, to translate harcoded tokens, will be enough with using the macros|*if|*else|*endif|, for example, the version in other language of the previous file would be:

|$/usr/local/bin/php
<?php
$data = <<<END
|TABLE|
END;
$data = str_replace("english text", "other_language_text", $data);
echo $data;
?>
DONE|Using this system, it would be easy to totally translate DA to any language without never modify the original templates and only modifying the archives of the 'lang' dirs when updating the version.

John, you think that the idea is attainable?

Ramon

Dmitry Zenkov
11-25-2005, 01:54 PM
Its better to use next code:

$data = preg_replace('/\benglish text\b/', 'other_language_text', $data);

Because of :
if We want to replace word "or" for example and there is a word "Sort" in the Token, The function str_replace replace both "or"!

Dmitry Zenkov
12-04-2005, 03:30 AM
redesb

Using this solution I found that it does not work with token |DIRECTORIES| (section “Password Protected Directories”) and token |DIRECTORYLIST| (section “File Manager”)!

How do you think why is it? And what should I do to translate this token?

redesb
12-04-2005, 09:23 AM
Welcome to the users club of the not imperial language suffers, Dmitry.

You are right, you can translate these sections due a chroot environment for security, the only solution I encounter to this problem was javascript translation but not finished yet.

Ramon

PauGasol
08-12-2006, 04:20 PM
That works? but with the updates that changes will be removed .

I think is better include the hardcoded words os phrases in the lang files

Plz reply to the open threads about that in the "Feedback & Feature Requests"

eSiK
08-31-2006, 01:16 AM
That example didn't work for me :(
I wonder why....

intercybernet
09-18-2006, 09:10 AM
Thank you