Support » Theme: First » Parameter incorrectly marked as translatable?

  • Hi,

    I just helped a user in the Swedish forum. She uses this theme (First) but noted that the links to previous and next post didn’t show the post names, but instead were literally saying %rubrik.
    I updated the translation and for these two strings I copied the source string %title to the translation, and then things started working well.

    So if you would be able to do it, it would probably be good to update rows 44-45 in /inc/template-tags.php that currently read:

     previous_post_link( '<div class="nav-previous"><div class="post-nav-title">' . __( 'Older post', 'first' ) . '</div>%link</div>', _x( '%title', 'Previous post link', 'first' ) );
     next_post_link(     '<div class="nav-next"><div class="post-nav-title">' . __( 'Newer post', 'first' ) . '</div>%link</div>', _x( '%title', 'Next post link', 'first' ) );

    Is this a string you search for and replace later on with a filter?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author Takao Utsumi

    (@utsumit)

    Hi,

    %title in previous_post_link and next_post_link displays the post title. This is a function of WordPress and please don’t translate it.

    https://developer.wordpress.org/reference/functions/previous_post_link/
    https://developer.wordpress.org/reference/functions/next_post_link/

    Thanks,

    • This reply was modified 1 year, 10 months ago by Takao Utsumi.

    Hi @utsumit
    Thank you for your reply.
    My point is that if %title shouldn’t be translated, then you’d be much better off making sure that this string can’t be translated in the first place.

    I.e. changing:

    previous_post_link( '<div class="nav-previous"><div class="post-nav-title">' . __( 'Older post', 'first' ) . '</div>%link</div>', _x( '%title', 'Previous post link', 'first' ) );
     next_post_link(     '<div class="nav-next"><div class="post-nav-title">' . __( 'Newer post', 'first' ) . '</div>%link</div>', _x( '%title', 'Next post link', 'first' ) );

    into:

    previous_post_link( '<div class="nav-previous"><div class="post-nav-title">' . __( 'Older post', 'first' ) . '</div>%link</div>', '%title');
     next_post_link(     '<div class="nav-next"><div class="post-nav-title">' . __( 'Newer post', 'first' ) . '</div>%link</div>', '%title');

    EditAdd:
    PS! Depending on how wide your screen is, you may need to scroll the code excerpts to the right to see the difference.

    Theme Author Takao Utsumi

    (@utsumit)

    I see! I’m considering it in the next update. Thank you for your feedback.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Parameter incorrectly marked as translatable?’ is closed to new replies.