satishsoni1 / clients-oriented-ftp

Automatically exported from code.google.com/p/clients-oriented-ftp
0 stars 0 forks source link

Translation and charset problems and solutions #279

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

Here are some problems and solutions for others languages.
Please do bakups files in DB before editing.
I suggest to make tests first on test installation, do not edit directly your 
working installation.

I have found that some strings have not been scanned and do not appear in the 
po file because there are some errors into the code, some __ and _e are missing.

The code need to be fixed and strings need to be rescanned to a new POT and 
then we need to update the PO files.

For english installation this is transparent and all strings will appear ok.

Some other languages files are located in \includes\plupload\js\i18n\
These strings appeared on upload pages 

There is 2 little modifications that can be done for the fr.js file
 'Filename' : 'Nom de fichier',
can be change to
 'Filename' : 'Nom du fichier',

 and

'Status' : 'Status',
can be change to
'Status' : 'Statut',

I'm using french translation and I'm having some issues with tables and button 
display, I'm trying to find solution and get back to you if I find solutions.

To fix wrong charset issues (french and other languages).
I have test it only with French language.
I'm using tips that users have posted and I made one working solution.

Make a new installation to test it, using r412 version and a new database.

-1 Create a new empty database: UTF-8 with and collation  
   utf8_general_ci
-2 Edit install/database.php file, remove all default charset and
   all collation    
   save the file.
-3 Edit includes/classes/database.php 
   add
   mysql_query("SET NAMES utf8"); 
   under 
   mysql_select_db(DB_NAME, $this->connection) or die(mysql_error());
   save the file.

-4 Edit includes/function.php 
   change 
   $str = htmlentities($str, ENT_QUOTES); 
   to 
   $str = htmlentities($str, ENT_QUOTES, $encoding='utf-8'); 
   save the file.

-5 The htmlentities function is used twice so this is why it's not working 
properly.

   This was tested on default template ,if you are using gallery or
   pinbox template you will have to edit their file too.

 edit \templates\default\default.php by removing htmlentities

<strong><?php echo htmlentities($file['name']); ?></strong>
to
<strong><?php echo ($file['name']); ?></strong>

<td class="description"><?php echo htmlentities($file['description']); ?></td>
to
<td class="description"><?php echo ($file['description']); ?></td>

<img src="<?php echo TIMTHUMB_URL; ?>?src=<?php echo $this_thumbnail_url; 
?>&amp;w=<?php echo THUMBS_MAX_WIDTH; ?>&amp;q=<?php echo THUMBS_QUALITY; ?>" 
class="thumbnail" alt="<?php echo htmlentities($this_file['name']); ?>" />

to

<img src="<?php echo TIMTHUMB_URL; ?>?src=<?php echo $this_thumbnail_url; 
?>&amp;w=<?php echo THUMBS_MAX_WIDTH; ?>&amp;q=<?php echo THUMBS_QUALITY; ?>" 
class="thumbnail" alt="<?php echo ($this_file['name']); ?>" />

save the file

-6 Make a new DB installation using the new DB created at step 1 and using the 
edited installation files edited at step 2.
Log and test it before using it.

Please let me know if you encounter any problem and which language you are 
trying to use.

Original issue reported on code.google.com by access_c...@hotmail.com on 2 May 2013 at 4:08

GoogleCodeExporter commented 8 years ago
FANTASTIC WORK!!!!!!
I will apply this immediatly and make it available for future versions, after 
making sure that existing data won't get corrupted.

Original comment by i...@subwaydesign.com.ar on 2 May 2013 at 4:23

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I forgot another file to edit 

-6 Edit manage-files.php by removing htmlentities

<?php echo htmlentities($row['filename']); ?>

to

<?php echo ($row['filename']); ?>

else {
echo htmlentities($row['filename']);
}

to

else {
echo ($row['filename']);
}

<a href="#" class="<?php if ($download_count > 0) { echo 'downloaders 
button_blue'; } else { echo 'button_gray'; } ?> button" rel="<?php echo 
$row["id"]; ?>" title="<?php echo htmlentities($row['filename']); ?>">
<?php echo $download_count; ?> <?php _e('downloads','cftp_admin'); ?>
</a>

to

<a href="#" class="<?php if ($download_count > 0) { echo 'downloaders 
button_blue'; } else { echo 'button_gray'; } ?> button" rel="<?php echo 
$row["id"]; ?>" title="<?php echo ($row['filename']); ?>">
<?php echo $download_count; ?> <?php _e('downloads','cftp_admin'); ?>
</a>

Original comment by access_c...@hotmail.com on 3 May 2013 at 11:21

GoogleCodeExporter commented 8 years ago
A string is missing into the po file for all language
edit-file.php

success message when editing a file
the actual code is
$msg = 'The file has been edited succesfuly.';

it's should be something like this
$msg = __('The file has been edited succesfuly.','cftp_admin');

you can translate directly the string into the code for a temporary solution

For french here the way to fix it for now

$msg = __('Le fichier a été édité avec succès.','cftp_admin');

The best way will be to rescan the whole POT file, I have try with no succes, 
the strings qty are not matching so I guess some paths or keywords are missing 
in my settings. I have scanned using these keywords _e and __
If anyone can help me with the scan I will appreciate.

Original comment by access_c...@hotmail.com on 3 May 2013 at 1:46

GoogleCodeExporter commented 8 years ago
Backend language file

Also be aware that if you have a ' in these 2 translated strings 

You are about to unassign
(if there is a ' in the string this will prevent multi check box selection on 
files list)

Title was not completed
(if there is a ' in the string this will hide the third box on edit-file page)

Using ' in your strings will cause problem with javascript 

don't use ' in your string
or
you can use this instead ’

There may be other issues that I have not encounter yet, maybe we should not 
use ' at all and replace it by ’ (both look very similare)

Original comment by access_c...@hotmail.com on 4 May 2013 at 7:14

GoogleCodeExporter commented 8 years ago
Very nice solution.

(merci pour cette aide appréciable ;) cela m'a bien servi.)

Original comment by renaud.p...@gmail.com on 7 May 2013 at 5:20

GoogleCodeExporter commented 8 years ago
Thanks, Solution worked perfectely for portuguese language.
Still missing solution for the list of clients...

Original comment by ge...@ancornet.com on 2 Oct 2013 at 4:35

GoogleCodeExporter commented 8 years ago
I made it
file clients.php replaced

<td><?php echo html_entity_decode($row["name"]); ?></td>
to
<td><?php echo ($row["name"]); ?></td>

Original comment by ge...@ancornet.com on 2 Oct 2013 at 4:47

GoogleCodeExporter commented 8 years ago
Excelente! Resolveu meu problema

Original comment by analytic...@gmail.com on 25 Oct 2013 at 7:28

GoogleCodeExporter commented 8 years ago
Hi 

Can anyone of you upload files that you modified to have language special 
characters working? I do not know php and can't handle myself. Appreciate your 
help. I'm on fresh install r514.

Original comment by play...@gmail.com on 13 Dec 2013 at 9:36

GoogleCodeExporter commented 8 years ago
Hello,

I had a similar problem with Japanese.
Changing the above alone would not help.
I also had to change the classes/file-upload.php and change the "safe_rename" 
variables so the filenames would not be renamed.

Original comment by peys....@gmail.com on 14 Mar 2014 at 12:36