Plural STRING in comments notification

3 years 4 months ago #321541 by timstohr
Plural STRING in comments notification was created by timstohr
Hi Kyle,
There are currently two problems with the translation of community builder. Often, I have no idea about the variables that are contained within the language strings eg [title] or [album] or whatever so I am trying to translate basically blind. Would it be possible to output a long list of all the Constants and their english translations? Just like you did for the triggers here: www.joomlapolis.com/documentation/18358-using-cb-triggers

Secondly, you are putting together notifications eg if people commented on the same post. That is really good. What is missing though is an additional constant for the plural.

Here is an example in english (which is correct):

Robert Rohlfs  and Thorsten Mötje  commented on your post Habe 10 Euro an die Holvi bank überwiesen. in group Gründung

Here is the translation in German (which is not correct because of the missing plural):
Robert Rohlfs  und Thorsten Mötje  hat einen Kommentar auf deinem Post Habe 750 Euro an die Holvi bank überwiesen. in der Gruppe Gründung geschrieben

In German, it should be:
Robert Rohlfs  und Thorsten Mötje  haben Kommentare auf deinem Post Habe 750 Euro an die Holvi bank überwiesen. in der Gruppe Gründung geschrieben

Could we therefore add more constants?

Please Log in to join the conversation.

3 years 4 months ago #321544 by krileon
Replied by krileon on topic Plural STRING in comments notification
Translate the entire plugin and it should resolve that issue as parts like that are also language strings. Language strings inside of language strings like that will be going away sometime in the future when we improve the language API or just likely when Twig is implemented and we can provide better more modular templates to help avoid duplicate coding. In that language string specifically those are as follows.

[type]

Can be any of the following.

photos
photo
files
file
videos
video
music

If there's more than one it's also sent through the following.

Key: COUNT_TYPES
Text: %%COUNT%% [types]

[album] is just the name of the actual album things were uploaded to. [title] is what was uploaded.

Would it be possible to output a long list of all the Constants and their english translations?

No, we can do that for triggers since it's easily parsed for.

Could we therefore add more constants?

No, as we don't want to add more compound language strings we want to actually get rid of them. What I can do is add type specific language keys to them for the time being so you can replace the entire string. Example as follows for what this means.

COMMENTED_ON_YOUR_TYPE_TITLE_IN_ALBUM

Would also have the following language key attached to it.

COMMENTED_ON_YOUR_PHOTO_TITLE_IN_ALBUM

This would then mean you can just exclude [type] in your translation and format the string however you need. Would this work for you for now?


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

3 years 4 months ago #321545 by timstohr
Replied by timstohr on topic Plural STRING in comments notification
Hi Kyle, the new ABOUT_TITLE language string works perfectly, no problem and is easy to translate. It is an elegant solution.

I was just proposing something (the list with all strings) to make the use of CB easier in general (not with reference to the ABOUT_TITLE string). I have been fighting on and off for a month with the translations now. I had thought that you would have a language file which you could just copy and paste on the website so that we who are doing the translation can use it as a reference. I could have used that a lot so that I know where the [variables] are in the text.

The verbs are different in German (and whole hosts of other languages) depending on if one person is commenting (hat ein Kommentar...geschrieben) and if several have commmented (haben...Kommentare geschrieben) so your solution would not solve the problem. It is more of a language problem.

To be honest, I cannot think of any way you can get around it. The grammar of the languages is so varied that you cannot use a singular string for meaning plural (english is one of the very few languages where you can as you have nearly no difference between singular and plural in the preteritum/past (eg commented/commented, he tore/they tore, he played/they played).

Now in German (er hat kommentiert/sie haben kommentiert; er zeriss/ sie zerissen; er spielte/ sie spielten), French (a commenté/ ont commentés; il a déchirré; ils ont déchirrés; il a joué/ils ont joués). Same for spanish and italian.

Kind regards,

Tim

Please Log in to join the conversation.

3 years 4 months ago #321546 by krileon
Replied by krileon on topic Plural STRING in comments notification
The new typed language keys described above are plural aware. For example if I upload 3 photos the language key would be as follows.

COMMENTED_ON_YOUR_PHOTOS_TITLE_IN_ALBUM COMMENTED_ON_YOUR_TYPE_TITLE_IN_ALBUM

If I only uploaded 1 it would be as follows.

COMMENTED_ON_YOUR_PHOTO_TITLE_IN_ALBUM COMMENTED_ON_YOUR_TYPE_TITLE_IN_ALBUM

This should be available now. If there's any other strings not plural aware that need to be please provide the language strings and will take a look.

I had thought that you would have a language file which you could just copy and paste on the website so that we who are doing the translation can use it as a reference. I could have used that a lot so that I know where the [variables] are in the text.

It is impossible for us to provide a list of every possible substitution value like that, sorry. That's just never going to happen. We try to make sure to at least name the substitutions something that could be guessed (e.g. [title] = title of the media).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

3 years 4 months ago #321547 by timstohr
Replied by timstohr on topic Plural STRING in comments notification
Easy to know which ones. Everywhere where you are updating the notifications to show more than one person (eg comments and likes), it needs to be plural aware.

If there is only one person is the "author" of the notification then it can be singular (eg Tim commented on post X). If you are combining two notifications (eg Tim and Kyle commented on post X) then it needs to be plural aware.

Please Log in to join the conversation.

3 years 4 months ago #321548 by krileon
Replied by krileon on topic Plural STRING in comments notification
That's the name grouping feature. There is a language string for that though. Specifically the below.

Key: NAMES_MORE_THAN_TWO
Text:
[name_1], [name_2], and [more]

Key: NAMES_MORE
Text:
[names] other|[names] others|%%COUNT%%

Key: NAMES_TWO
Text:
[name_1] and [name_2]

These however are not connected to the activity title output and is a separate string. Hopefully in the future this will change and just be a single language string, but I can't say for sure at this time as we haven't replaced internal APIs with Symfony yet and rewrote template files to Twig.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.393 seconds

Facebook Twitter LinkedIn