mennake / thematic

Automatically exported from code.google.com/p/thematic
0 stars 0 forks source link

Improve Translation Strings + split admin/front-end #152

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
for example:

sprintf( __( 'You can include a %s in a childtheme', 'thematic' ) . '.', 
'home.php' )

sprintf should not be used in this case, because in some languages the 
translation changes depending on the "gender" of the noun being substituted.... 
 or instance in french if the string was 

You can include a table in a childtheme
une table

You can include a desk in a childtheme
un tableau

so it isn't correct to translate the string as 
Vous pouvez inclure un % dans un thème enfant

because the "un" (article) depends on the % and a translator can't know what 
that is. 

therefore, the string should be complete and 

'You can include a home.php in a childtheme'

source:
http://wordpress.stackexchange.com/questions/55179/translate-a-string-to-a-langu
age-with-masculin-feminine-nouns/55190#55190

apparently it is also worth considering splitting the admin and front-end 
translations as translation takes up a lot of memory.  

Original issue reported on code.google.com by helgathe...@gmail.com on 14 Jun 2012 at 12:16

GoogleCodeExporter commented 9 years ago
Tagging... all good points.

Original comment by eugene.m...@gmail.com on 14 Jun 2012 at 8:14

GoogleCodeExporter commented 9 years ago
Ok so why wouldn't a translators note be enough? 
It is there so translators know exactly what is translated

/* translators: home.php template file */

Maybe in this particular case it's no problem to include the substituted noun. 
I just want to know best practices for future reference. From what I gather 
from the answer the problem emerges when the same string is used in several 
places to refer to different nouns.

Original comment by invistr...@gmail.com on 4 Jul 2012 at 9:54

GoogleCodeExporter commented 9 years ago
Didn't know in which of all our localization issues to put this patch, but here 
goes. A first round of content-extensions.php. For reference I used Otto's 
primer 
http://ottopress.com/2012/internationalization-youre-probably-doing-it-wrong/

I have added some translators notes, as well as context in a few places.

A couple of uncertainties:
- If html markup should be removed from the nav-above and nav-below strings. I 
kept them in for now.
- How to best handle the postfooter_postconnect strings. The best for 
translation is to keep the sentences intact. I tried a couple of sprintf 
versions but didn't really find a  way that seemed good. In the comments to 
Otto's article they discuss what to do with inline links, and he says basically 
that with links embedded in paragraphs it might be necessary to include them in 
the translated string. It would depend on the context. 

I thought of something like this:
/* translators: 1: comment link, 2: Trackback URL */
$postconnect = sprintf( __( '<a %1$s>Post a comment</a> or leave a trackback: 
%2$s.', 'thematic' ), 
    'class="comment-link" href="#respond" title ="' . __('Post a comment', 'thematic') . '"',
    '<a class="trackback-link" href="' . get_trackback_url() . '" title ="' . __('Trackback URL for your post', 'thematic') . '" rel="trackback">' . __('Trackback URL', 'thematic') . '</a>'
     );

Original comment by invistr...@gmail.com on 4 Jul 2012 at 10:41

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
i agree it seems simpler, but by not splitting strings, karin is following the 
advice of otto, who's in the wp core dev group

see the link she posted.  maybe we should go straight to otto and ask his 
opinion?

Original comment by helgathe...@gmail.com on 6 Jul 2012 at 10:03

GoogleCodeExporter commented 9 years ago
Sorry, I know too little about this and noticed my propoosal wouldn't work well 
with other strings. I guess I'll let you people who know what they're doing 
handle this ;)

Original comment by codec...@chokebore.net on 6 Jul 2012 at 10:06

GoogleCodeExporter commented 9 years ago
check out the link above to ottopress.  pretty much those are the guidelines 
we're following.  some of us (me!) don't really know what we're doing on this 
subject either. 

Original comment by helgathe...@gmail.com on 6 Jul 2012 at 10:25

GoogleCodeExporter commented 9 years ago
I'm certainly not taking offence for different suggestions. :) I didn't include 
any edits of the postconnect_postfooter in the patch for the very reason that I 
wasn't really sure what the best solution would be.

The original code contains one of those strings with leading spaces that we are 
trying to get rid of. Most of those strings come from the fact that sentences 
are split up, and I am trying to connect the sentences together. With as little 
markup as possible in the actual strings. 

The nested sprintf's is something similar to what I've seen in twentyeleven, 
for example in content-gallery.php. Took me a while to figure out what's going 
on there. But if the priority is to have complete sentences and include 
punctuation, I don't know any better way.

Original comment by invistr...@gmail.com on 7 Jul 2012 at 6:18

GoogleCodeExporter commented 9 years ago
Thanks for your kind reply. I guess I'll leave the coding to you and stick with 
the translation :)
Btw your diff fixes a problem I was having with a fragmented string ("Browse 
the %s archive"), so thanks a lot for that!

Original comment by codec...@chokebore.net on 7 Jul 2012 at 10:12

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I need to look over your diff.... but here's my stab at the 
thematic_postfooter_postconnect().  i'm debating between 1: remove all leading 
and trailing spaces from the individual functions and then add them to the 
calling function, like so:

function thematic_postfooter(){
$postfooter = function1() . ' ' . function2() . ' ' . function3();
return $postfooter;
}

or 2:
leaving a trailing space in function1(), function2() and so on so that you 
don't need any spaces in thematic_postfooter and filtering/overriding 
function2() will leave functions 1 and 3 appropriately space.  

am i making any sense?  i'm inclined to think that 1 is easier? if you want to 
remove function2 from the postfooter, you'd override/filter the postfooter, no?

Original comment by helgathe...@gmail.com on 7 Jul 2012 at 7:23

Attachments:

GoogleCodeExporter commented 9 years ago
weren't enough admin only strings to warrant splitting. but strings were 
overhauled.

Original comment by helgathe...@gmail.com on 28 Oct 2012 at 10:30