StudioPress Community Forums

StudioPress Community Forums (http://www.studiopress.com/support/index.php)
-   General Discussion (http://www.studiopress.com/support/forumdisplay.php?f=7)
-   -   Problem with italian translation (http://www.studiopress.com/support/showthread.php?t=10546)

CHARLIEGOLF 07-02-2009 10:12 AM

Problem with italian translation
 
I have translated all the dafault strings of my Lifestyle theme with poedit. I just want to know which name I have to give to the two file .po and .mo Is it right it_IT.po (.mo) or it.po(.mo) or default.po(.mo)? I tried to upload each of those files but I don't see the italian translation of the strings. Tnx in advance

www.charliegolf.it/home

Craig Tuller 07-02-2009 10:17 AM

Re: Problem with italian translation
 
http://www.studiopress.com/tips/transla ... -theme.htm

CHARLIEGOLF 07-02-2009 02:09 PM

Re: Problem with italian translation
 
I have read the tips and I made everthing written in it but my theme still remains in English. I have the it_IT.mo &.po file in languages folder theme but nothing happens.

http://www.charliegolf.it/home

Craig Tuller 07-02-2009 09:07 PM

Re: Problem with italian translation
 
Looks like it is in Italian to me.

itsfashionbaby 07-03-2009 02:36 AM

Re: Problem with italian translation
 
Actually I have the same problem with my Danish translation - my url is www.itsfashionbaby.dk

CHARLIEGOLF 07-03-2009 02:59 AM

Re: Problem with italian translation
 
To me it is not in Italian. just only the posts i wrote. Don't know. I think it's missing something because my question is: how the theme knows to keep the italian .mo instead the default theme of the lifestyle?
Tnx

Craig Tuller 07-03-2009 08:20 AM

Re: Problem with italian translation
 
Yes, you need to add all of the English words that are used within the theme, into your translation files. You can probably download one of the other 2 translation files & take a peek at what they did. You will see what words they translated from english to swedish for example.

itsfashionbaby 07-03-2009 10:49 AM

Re: Problem with italian translation
 
Quote:

Originally Posted by Craig Tuller
Yes, you need to add all of the English words that are used within the theme, into your translation files. You can probably download one of the other 2 translation files & take a peek at what they did. You will see what words they translated from english to swedish for example.

I have added all of the English words - I used Poedit to translate everything, and it's still not translated on my page - www.itsfashionbaby.dk

What am I doing wrong?

Where can I download the translation files?

adew 07-03-2009 11:39 AM

Re: Problem with italian translation
 
Did you create the .po and .mo files with Poedit and upload them to the lifestyle/languages directory?

itsfashionbaby 07-03-2009 12:12 PM

Re: Problem with italian translation
 
Quote:

Originally Posted by adew
Did you create the .po and .mo files with Poedit and upload them to the lifestyle/languages directory?

Yes I did - and I translated all the words using Poedit as well.

The only thing, I can think of, is that I wasn't sure what to name the file, - if it should be da_DK or da_DA - but I don't know, if that even matters?

adew 07-03-2009 12:38 PM

Re: Problem with italian translation
 
File names should be da_DK.mo and da_DK.po

itsfashionbaby 07-03-2009 02:05 PM

Re: Problem with italian translation
 
Quote:

Originally Posted by adew
File names should be da_DK.mo and da_DK.po

That's also what I named them - so that's another thing, that can be left out.

I really cannot figure out, where it's gone wrong...

adew 07-03-2009 02:17 PM

Re: Problem with italian translation
 
What's the location of the files?

itsfashionbaby 07-03-2009 02:26 PM

Re: Problem with italian translation
 
Quote:

Originally Posted by adew
What's the location of the files?

It's itsfashionbaby.dk / httpdocs / wp-content / themes / lifestyle_40 / languages

httpdocs is my root directory

Craig Tuller 07-03-2009 02:32 PM

Re: Problem with italian translation
 
Check the file permission settings for /languages

itsfashionbaby 07-03-2009 02:44 PM

Re: Problem with italian translation
 
Quote:

Originally Posted by Craig Tuller
Check the file permission settings for /languages

The nummeric value is 755 - rwx r-x r-x

adew 07-03-2009 02:59 PM

Re: Problem with italian translation
 
I've just realised you probably don't have the right code in the theme's functions.php. Add this below the opening <?php tag:

Code:

function test_localization( $locale ) {
        return "da_DK";
 }
 add_filter('locale','test_localization');

load_theme_textdomain('studiopress', TEMPLATEPATH.'/languages/');


Don't forget, you also need to be running Wordpress in Danish if you want all Wordpress core stuff in Danish.

CHARLIEGOLF 07-03-2009 04:03 PM

Re: Problem with italian translation SOLVEDDDD
 
SOLVED!!!!!!!!!!!!!!!!!!!1


I noticed that all the strings should have this structure:


Code:

<?php _e("ENGLISH string", 'studiopress'); ?>
or
Code:

__('English string', 'studiopress')
In lifestyle it's not so! Except for few strings lot of them miss the the name theme "studiopress" like this:

Code:

<?php _e("ENGLISH string"'); ?>
or
Code:

__('English string')
You have simply add
Code:

, 'studiopress'
inside the parentesis. Not all the theme is well formatted for international localization. It's very important!!!!!!!!!!!!!!!!!!!!!!!!11 :lol: :lol: :lol: :lol:

It is not use to put the other function

itsfashionbaby 07-03-2009 04:10 PM

Re: Problem with italian translation SOLVEDDDD
 
Quote:

Originally Posted by CHARLIEGOLF
SOLVED!!!!!!!!!!!!!!!!!!!1


I noticed that all the strings should have this structure:


Code:

<?php _e("ENGLISH words", 'studiopress'); ?> or __('No Responses', 'studiopress')
In lifestyle it's not so! Except for few strings lot of them miss the the name theme "studiopress" like this:

[code:1e8mgl6l]<?php _e("ENGLISH words"'); ?> or __('No Responses')[/code]
You have simply add [color=#0000FF:1e8mgl6l], 'studiopress'[/color] inside the parentesis. Not all the theme is well formatted for international localization. It's very important!!!!!!!!!!!!!!!!!!!!!!!!11 :lol: :lol: :lol: :lol:


in which file is this?

CHARLIEGOLF 07-03-2009 04:12 PM

Re: Problem with italian translation
 
in all the template file header, comments and so on. Go to editor theme and check all the string missing the word studiopress

adew 07-03-2009 04:18 PM

Re: Problem with italian translation
 
You're right - the texdomain name "studiopress" isn't in the code.

adew 07-03-2009 04:25 PM

Re: Problem with italian translation
 
@ CHARLIEGOLF,

Can you post your functions.php file? I'm curious about something...

CHARLIEGOLF 07-03-2009 04:36 PM

Re: Problem with italian translation
 
Code:

<?php

load_theme_textdomain('studiopress', TEMPLATEPATH.'/languages/');
add_filter('comments_template', 'legacy_comments');

function legacy_comments($file) {

        if(!function_exists('wp_list_comments')) : // WP 2.7-only check
                $file = TEMPLATEPATH . '/legacy.comments.php';
        endif;

        return $file;
}

// Turn a category ID to a Name
function cat_id_to_name($id) {
        foreach((array)(get_categories()) as $category) {
            if ($id == $category->cat_ID) { return $category->cat_name; break; }
        }
}

// include the breadcrumb nav tool
include(TEMPLATEPATH."/tools/breadcrumbs.php");

// include the theme options
include(TEMPLATEPATH."/tools/theme-options.php");

if ( function_exists('register_sidebars') )
        register_sidebar(array('name'=>'Sidebar Top',));
        register_sidebar(array('name'=>'Sidebar Bottom Left',));
        register_sidebar(array('name'=>'Sidebar Bottom Right',));
        register_sidebar(array('name'=>'468x60 Header Banner',));
        register_sidebar(array('name'=>'468x60 Post Banner',));

function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
    $content = get_the_content($more_link_text, $stripteaser, $more_file);
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]&gt;', $content);
    $content = strip_tags($content);

  if (strlen($_GET['p']) > 0) {
      echo "

";
      echo $content;
      echo "<a href='";
      the_permalink();
      echo "'>".__("Read More")." &rarr;</a>";
      echo "</p>";
  }
  else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
        $content = substr($content, 0, $espacio);
        $content = $content;
        echo "

";
        echo $content;
        echo "...";
        echo "<a href='";
        the_permalink();
        echo "'>".$more_link_text."</a>";
        echo "</p>";
  }
  else {
      echo "

";
      echo $content;
      echo "<a href='";
      the_permalink();
      echo "'>".__("Read More")." &rarr;</a>";
      echo "</p>";
  }
}

function sp_widget() {
    require_once(ABSPATH.WPINC.'/rss.php');
    if ( $rss = fetch_rss( 'http://feeds2.feedburner.com/studiopress' ) ) {
        $content = '<div class="rss-widget>"';
        $content .= '<p style="border-bottom: 1px solid #ccc; padding-bottom: 10px; font-weight: bold;"><a rel="nofollow" href="http://www.studiopress.com/themes/pro-plus">Upgrade now to the Pro Plus All-Theme package for only $140 --></a
 (Use PPUPG as the discount code when you are on the shopping cart page.)</p>';
        $content .= '<ul>';
        foreach ( array_slice( $rss->items, 0, 5 ) as $item ) {
            $content .= '[*]';
            $content .= ''.htmlentities( $item['title'] ).'';
            $content .= ' <span class="rss-date">'.date('F j, Y',strtotime($item['published'])).'</span>';
            $content .= '<div class="rssSummary">'.htmlentities( $item['summary'] ).'</div>';
            $content .= '';
        }
        $content .= '[/list]';
                $content .= '<p style="border-top: 1px solid #ccc; padding-top: 10px; font-weight: bold;">http://www.studiopress.com/images/rss.pngSubscribe to RSShttp://www.studiopress.com/images/rss.png</a>Subscribe via Email</p>';
        $content .= '</div>';
        echo $content;
    }
}
 
function sp_widget_setup() {
    wp_add_dashboard_widget( 'sp_db_widget' , 'The Latest News From StudioPress' , 'sp_widget');
}
 
add_action('wp_dashboard_setup', 'sp_widget_setup'); 

// Remove WP Generator for security reasons
remove_action('wp_head', 'wp_generator');
?>


adew 07-03-2009 04:53 PM

Re: Problem with italian translation
 
Thanks. :)

itsfashionbaby 07-03-2009 04:58 PM

Re: Problem with italian translation
 
Quote:

Originally Posted by adew
Thanks. :)

So it is the correct way to solve the problem?

Because in that case, it's not really internationalized...

adew 07-03-2009 05:04 PM

Re: Problem with italian translation
 
Yes, that's the way to fix it and no, it's not fully internationalised*. I've alerted Brian so that he is aware of the issue.

* To be picky, it is internationalised but the textdomain name isn't in the code. Functions.php is also missing this code:
Code:

load_theme_textdomain('studiopress', TEMPLATEPATH.'/languages/');

itsfashionbaby 07-03-2009 05:14 PM

Re: Problem with italian translation
 
Quote:

Originally Posted by adew
Yes, that's the way to fix it and no, it's not fully internationalised*. I've alerted Brian so that he is aware of the issue.

* To be picky, it is internationalised but the textdomain name isn't in the code. Functions.php is also missing this code:
Code:

load_theme_textdomain('studiopress', TEMPLATEPATH.'/languages/');

Thanks to both of you for solving this problem.

Where should this code be added to the functions.php?
And should I still add the other code, you told me previously?

adew 07-03-2009 05:21 PM

Re: Problem with italian translation
 
Ignore the previous code I told you about (assuming you're not running a multilingual site) and add this just below the opening <?php tag at the top of the file:
Code:

load_theme_textdomain('studiopress', TEMPLATEPATH.'/languages/');
It should only take you ten minutes or so to skim through the template files and add the missing "studiopress" textdomain. :)

imaginateca 07-06-2009 03:26 PM

Re: Problem with italian translation
 
Thank you guys. I had the same problem in Spanish. Now almost everything run smooth.

BTW. Does any of you how to get the date in the head translated too? Is the only thing I couldn't...

adew 07-06-2009 04:17 PM

Re: Problem with italian translation
 
Hi,

If you're running WP in Spanish the date should be in Spanish. Can you post your URL?

imaginateca 07-06-2009 05:28 PM

Re: Problem with italian translation
 
Hi Adew,

Actually, what I have seen is that the function date() is not part of Wordpress, but of PHP. So, if your server is running a PHP version in other language different than yours (well, if it is defined in config) and you do not have access to its configuration, you will have the date in the server's language. That is my problem right now.

So, my solution for this have been this:

In header.php, where it says:

Code:


<?php echo date("l, F j, Y"); ?></p>

I have deleted that and put instead a script that you can find in some Spanish forums:

Code:




<script language="JavaScript" type="text/JavaScript">
dows = new Array("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado");
months = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
now = new Date();
dow = now.getDay();
d = now.getDate();
m = now.getMonth();
h = now.getTime();
y = now.getFullYear();
document.write(dows[dow]+", "+d+" de "+months[m]+" de "+y);
</script>
</p>

That is. Now I have the date in a perfect Spanish ;)

Antonio
PD: I will post the URL as soon as the website is online, now I have running it in local (Xampp for Linux)

adew 07-06-2009 05:35 PM

Re: Problem with italian translation
 
Good work, Antonio! You're absolutely right, of course, we're talking about a standard PHP function not a WP function. Your solution looks good to me. :)

Looking forward to seeing your site when it's up and running.

audilo 07-09-2009 10:04 AM

Re: Problem with italian translation
 
Just to thanks you guys, used all the stuff here and got my FR translation uploaded and working as well as changed the date!

I used that Spanish script and simply replace the days and months in FR of course, as well as the write format...

Here it is for those who need it ready made:

Code:



<script language="JavaScript" type="text/JavaScript">
dows = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
months = new Array("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre");
now = new Date();
dow = now.getDay();
d = now.getDate();
m = now.getMonth();
h = now.getTime();
y = now.getFullYear();
document.write(dows[dow]+" "+d+" "+months[m]+"  "+y);
</script>
</p>


On another note, shouldn't you create a repository folder where people could upload their .po and .mo files... Would be good me think...

Vincent

adew 07-09-2009 10:11 AM

Re: Problem with italian translation
 
Vincent,

Thanks for your post.

I agree - a repository of translations would be an excellent idea, and I'll pass on your suggestion to Brian. :)

audilo 07-09-2009 12:09 PM

Re: Problem with italian translation
 
Talking about the date translated, just noticed that the coments left on a post are dated as well...
Where would be to file to modify that date format??

edit: same when you click on a category page for example, the posts are listed chronologically, but using English date ...

adew 07-09-2009 12:59 PM

Re: Problem with italian translation
 
Quote:

same when you click on a category page for example, the posts are listed chronologically, but using English date ...
These dates are being output by core WP, therefore if you run WP in fr_FR these will be translated into French.

adew 07-11-2009 11:50 AM

Re: Problem with italian translation
 
Quote:

Originally Posted by adew
Vincent,

Thanks for your post.

I agree - a repository of translations would be an excellent idea, and I'll pass on your suggestion to Brian. :)

Translation files can be uploaded here: Theme Translations/Localisations

:)

itsfashionbaby 07-12-2009 05:59 AM

Re: Problem with italian translation
 
Sorry for being a complete blonde - but I'm not completely sure where to add the missing 'studiopress' in the various files.

Could anyone please post a screendump?

Brian Gardner 07-12-2009 08:18 AM

Re: Problem with italian translation
 
The best thing to do would be to download the latest version from here as that has been updated with the correct localization code: viewtopic.php?f=8&t=2522

Quote:

Originally Posted by itsfashionbaby
Sorry for being a complete blonde - but I'm not completely sure where to add the missing 'studiopress' in the various files.

Could anyone please post a screendump?


itsfashionbaby 07-12-2009 09:04 AM

Re: Problem with italian translation
 
Thank you so much - everything is working perfectly now!

Quote:

Originally Posted by Brian Gardner
The best thing to do would be to download the latest version from here as that has been updated with the correct localization code: viewtopic.php?f=8&t=2522

Quote:

Originally Posted by itsfashionbaby
Sorry for being a complete blonde - but I'm not completely sure where to add the missing 'studiopress' in the various files.

Could anyone please post a screendump?



adew 07-12-2009 11:47 AM

Re: Problem with italian translation
 
@ itsfashionbaby,

Glad to hear all is working now. :)

indignacion 07-13-2009 02:57 AM

Re: Problem with italian translation
 
Hi, I haven't figured out a way to make the Lifestyle theme to display the date in the correct language. I am using the Spanish version of Wordpress, I have translated all of it with poedit (as suggested) and everything is fine except the upper left date stamp.

I can always delete it from the header but I guess it looks kinda' cool there. Is there any way I could have a quick answer about this?

Thanks!

Edit: Oh, and I am using the current version (4.0) of the theme.

adew 07-13-2009 06:20 AM

Re: Problem with italian translation
 
Hi,

If your server is running PHP in Spanish, these dates will be translated automatically.


All times are GMT -5. The time now is 09:53 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.