reopen: post type name translation not possible
This topic contains 12 replies, has 3 voices, and was last updated by Stiofan O’Connor 7 years, 12 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: i18n, language, translation
-
AuthorPosts
-
November 7, 2016 at 10:41 am #299413
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!
November 7, 2016 at 10:55 am #299417your 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.November 7, 2016 at 11:48 am #299462Places 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.
November 7, 2016 at 12:32 pm #299472again, 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?
November 7, 2016 at 12:36 pm #299475So 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??November 7, 2016 at 12:41 pm #299498So, 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>
November 7, 2016 at 12:47 pm #299500and @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?November 7, 2016 at 1:48 pm #299517There 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.
November 8, 2016 at 11:58 am #300088Hi 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
November 8, 2016 at 12:49 pm #300142Hi 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.
November 8, 2016 at 1:35 pm #300165Yes 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
November 9, 2016 at 1:30 pm #300717yes filters would be fine
November 10, 2016 at 1:39 pm #301325OK 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
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket