reopen: post type name translation not possible

This topic contains 12 replies, has 3 voices, and was last updated by  Stiofan O’Connor 8 years ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #299413

    Rainer Lang
    Expired Member
    Post count: 33

    Dear Stiofan,

    this is a reopening of this topic, because it is absolutely not solved:
    https://wpgeodirectory.com/support/topic/not-possible-to-translate-strings-using-posttype-name/

    To be honest we’re really getting angry now because of your total lack of motivation to help and to improve your plugin.

    Maybe it’s really to hard for you to understand the grammar of a foreign language, but in fact your way of translating, described in the linked topic above, is absolutely not WordPress codex conform.
    Did you ever heard of “declination” other languages use for nouns?
    Maybe you heard of a grammatical thing like “nominative”, usually without declination, and you heard of “genitive”, usually with declination.
    And maybe you know the difference between a real name like “Stiofan” and a usual noun like “place”.
    So maybe your country is “USA”, and yes, you can translate the sentence (“Your country is %1$s”, $country) to all languages without declination, because this is nominative AND a real name (“USA”). There is usually no declination.
    But there is a declination for nouns like “place” in genitive and I already gave you clear examples of how the correct German would look like for “Place Title” and “Place Description”.
    I even gave you a good patch for improving this issue. So why don’t you use this patch?

    So if you absolutely don’t want your plugin to be compatible with other languages than English, and don’t want to use patches by your customers, than at least give us filters, that we can do it our own without hacking your plugin.

    And please, before you close a topic, at least wait for the customers answer, if it is really closed. Your way of “support” is quite unfriendly and ignorant for a paid plugin!

    #299417

    Rainer Lang
    Expired Member
    Post count: 33

    your way to translate individual post type names, mentioned in the topic linked above, doesn’t help us at all. We don’t use custom post types, we use places and events only.
    So, I tried using GD Tools as described, but the file db-language.php is empty, there is no string added.

    #299462

    Guust
    Moderator
    Post count: 29970

    Places and Events are the two default custom post types, but they are still custom post types.

    So you would translate Events and Event in the event language file and Place and Places in the Core language file.

    Using the Custom Post Types addon will allow you to translate Events and Event and Place and Places direct in the admin backend too.

    #299472

    Rainer Lang
    Expired Member
    Post count: 33

    again, the problematic is about the following:
    “%s Title” and “%s Description”

    In German the correct translation for “%s Title” would be:
    “Place Title” = “Titel des Platzes
    “Event Title” = “Titel der Veranstaltung”

    Do you see the difference?
    The genitive declination of “place” is in German with the pronoun “des” (and this is different from “der” – can you read?), and ends on “es”, the German word for event is “Veranstaltung” und doesn’t have a genitive ending.

    Is that so hard to understand?

    #299475

    Rainer Lang
    Expired Member
    Post count: 33

    So if I have to translate “%s Title” with your type of logic, this would be:
    “Place Title” = “Titel Platz” (completely wrong German) or “Titel der Platz” (completely wrong, too)
    or I set this to “Titel des Platzes” – nice, this would be right, BUT (!!!) then “Event Title” would be “Titel des Veranstaltunges” (uaaah, completely wrong!)
    Got it??

    #299498

    Rainer Lang
    Expired Member
    Post count: 33

    So, since I had to repeat this, I repeat my suggestion for a patch, too:

    As the two main posttypes are places and events, I’d suggest to add a conditional clause:
    in geodirectory_template_actions.php this is line 2215:

    <label><?php echo sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ); ?><span>*</span> </label>

    change it to:

    
    
    <label><?php 
    if($cpt_singular_name == 'gd_place')
    _e('Place Title', 'geodirectory');
    elseif($cpt_singular_name == 'gd_event')
    _e('Event Title', 'geodirectory');
    else
    echo sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ); 
    ?><span>*</span> </label>

    the same for description would be in line 2267:

    <label><?php echo sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>

    change it to:

    
    
    <label><?php 
    if($cpt_singular_name == 'gd_place')
    _e('Place Description', 'geodirectory');
    elseif($cpt_singular_name == 'gd_event')
    _e('Event Description', 'geodirectory');
    else
    echo sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ); 
    ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
    #299500

    Rainer Lang
    Expired Member
    Post count: 33

    and @guust you are wrong: Of course we already translated “Place” and “Event” in the language files. But the problem is, that in these code pieces mentioned by me, the translation is not used!
    We already setup everythin with places ant events. Now you want us to completely start new with custom post types? Only because you don’t want to change these two code pieces?

    #299517

    Guust
    Moderator
    Post count: 29970

    There is no need to set up anything new when activating the CPT addon, it will just make translations a lot easier. Try it.

    Maybe you can translate “%s Title” to “Titel – %s”, then it does not really matter.

    I am not sure that those code changes will solve things for every language, it might solve things for German, but I already alerted the developers to have a look at your post too.

    #300088

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Rainer,

    Let me assure you i am here to help, why would i not want to make out products better?, i posted my reply on the other topic and got no reply from you, our system automatically closes posts after 30 days of no activity.

    If i understand your problem correctly then your solution would not work either, it might work for Places and Events but what about CPT that could have any name, this is why i would not apply a patch for something that will not work for all.

    My only idea at this point is we add it like this (which is totally wrong):

    __($cpt_singular_name.' Title', 'geodirectory' );

    And then it can then be translated via this technique: https://wpgeodirectory.com/docs/translating-custom-fields/

    Please let me know your thoughts.

    Thanks,

    Stiofan

    #300142

    Rainer Lang
    Expired Member
    Post count: 33

    Hi Stiofan,

    thanks for your reply! Sorry for maybe wrong accusing. (We got that feeling afer the security issues, but that’s another topic.)

    Yes, my solution would only work for places and events, that’s right. For other CPTs it would stay as it is.
    I think your idea would not add this to the po files. I’m not sure about your mentioned functionality. But when I tried it before, the db-language.php stayed empty, no strings added to po or anywhere.

    I now installed your custom post types addon to get an idea of it. I didn’t start using it yet, but if it works as expected it could be an idea to add the mentioned strings to the LABELS in advanced mode. (“Place Title” and “Place Description” to the label section of advanced edit mode of post type gd_place, and “Event Title” and “Event Description” to the label section of advanced edit mode of post type gd_event).
    What do you think about that?

    After backing up my testing environment and setting up the custom post types to our use, I’ll let you know.

    #300165

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Yes my solution would not add it to the po file direct, it would need to be scanned and added to the language file and then scanned again by poedit.

    Again your solution would only work for people with CPT addon, i need to make this work for everyone.

    I think the easiest solution might just be to add filters to them?

    Stiofan

    #300717

    Rainer Lang
    Expired Member
    Post count: 33

    yes filters would be fine

    #301325

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    OK i have added filters for both of these and it will be in the next release:

    
    
    /**
                     * Filter the add listing page title input label.
                     *
                     * @since 1.6.11
                     * @param string $title The title to be output.
                     * @param string $cpt_singular_name The singular title of the curent CPT.
                     * @param string $listing_type The CPT being requested. ie: gd_place.
                     */
                    echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type);
    
    
    /**
                     * Filter the add listing page description input label.
                     *
                     * @since 1.6.11
                     * @param string $title The title to be output.
                     * @param string $cpt_singular_name The singular title of the curent CPT.
                     * @param string $listing_type The CPT being requested. ie: gd_place.
                     */
                    echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type);

    Thanks,

    Stiofan

Viewing 13 posts - 1 through 13 (of 13 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount