HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Problems translating the Activity page

TudorTudor
edited June 2011 in Localization
Presently, for some languages the Activity page cannot be correctly translated. I've been trying to translate Vanilla in Romanian and I have issues with:
- The verb conjugation.
- The genitive case.
- The definitive article.

I'm not a programmer so I don't know what could be done to solve those problems, but right now I'd be much, much happier if I could just translate entire sentences like this:

1) $Definition['%s commented on your discussion'] = '%s a comentat la discuția ta'; 2) $Definition['You started a discussion'] = 'Ai început o discuție'; (Notice how "discussion" is translated differently; and we don't use "you" at all in example #2.) 3) $Definition['%s started a discussion'] = '%s a început o discuție'; (A different translation for "started"; "he/she started" in #3 vs. "you started" in the example #2.) 4) $Definition['%s mentioned you in a discussion'] = '%s te-a menționat într-o discuție'; 5) $Definition['%1$s mentioned %2$s in a discussion'] = '%1$s a menționat pe %2$s într-o discuție'; ("Mentioned you" vs. "mentioned him/her": different translations for the verb "mentioned", according to the Romanian conjugation.) 6) $Definition['%1$s commented on %2$s\'s discussion'] = '%1$s a comentat la discuția lui %2$s'; (here I want to remove the English 's possessive and use the Romanian genitive case.)

Maybe a programmer could create a plugin to fix these things?
Tagged:

Comments

  • ToddTodd Chief Product Officer Vanilla Staff
    I'm not sure either, but someone had put in features for Eastern European languages a while back. There are additional codes you can use:

    %1$s = ActivityName
    %2$s = ActivityName Possessive
    %3$s = RegardingName
    %4$s = RegardingName Possessive
    %5$s = Link to RegardingName's Wall
    %6$s = his/her
    %7$s = he/she
    %8$s = route & routecode
    %9$s = gender suffix (some languages require this).
  • 6) $Definition['%1$s commented on %2$s\'s discussion'] = '%1$s a comentat la discuția lui %2$s'; (here I want to remove the English 's possessive and use the Romanian genitive case.)
    You can override FormatPossessive() function in locale definitions file like this.
    if (!function_exists('FormatPossessive')) {
    function FormatPossessive($Word) {
    return $Word;
    }
    }
    Also see /applications/dashboard/locale/en-CA/definitions.php for example.

    For the rest of issues #1-#5, I have no idea.

    Maybe we need new wrapper function for activities.
    Just a thought ...

    /library/core/class.format.php

    Replace:
    return sprintf($MessageFormat, $ActivityName, $ActivityNameP, $RegardingName, $RegardingNameP, $RegardingWall, $Gender, $Gender2, $Route, $GenderSuffix, $RegardingWallLink, $ActivityRouteLink);
    with:
    if (!function_exists('MessageFormatLocal')) {
    $MessageFormat = MessageFormatLocal($MessageFormat, $ActivityName, $ActivityNameP, $RegardingName, $RegardingNameP, $RegardingWall, $Gender, $Gender2, $Route, $GenderSuffix, $RegardingWallLink, $ActivityRouteLink);
    }

    return sprintf($MessageFormat, $ActivityName, $ActivityNameP, $RegardingName, $RegardingNameP, $RegardingWall, $Gender, $Gender2, $Route, $GenderSuffix, $RegardingWallLink, $ActivityRouteLink);
    Then, we can define MessageFormatLocal() function in locale definitions file.

    How do you think, @Todd?
  • My activities doesn't get translated at all while any other parts do.
    Have you experienced such a thing?
  • No, I haven't. Which activities? How did you define them?
  • Profile page -> Activity.
    Sentences like "You commented on sy's discussion." remain in English.
    They're defined like any other definition in my language's definitions.php.
  • Did you defined them properly like this?
    $Definition['Activity.DiscussionComment.FullHeadline'] = '%1$s commented on %4$s %8$s.';
    $Definition['Activity.DiscussionComment.ProfileHeadline'] = '%1$s commented on %4$s %8$s.';
    I copied Baseline locale addon for my translation and no prob.
  • Thanks, it works now. I didn't know about baseline locale addon.

    One more thing: could you maybe give me a hint where sentences like "You commented on your bookmarked discussion." put together exactly? I'd like to change the order of words, try to make them more friendly for my language.
  • $Definition['Activity.BookmarkComment.FullHeadline'] = '%1$s commented on your %8$s.';
    $Definition['Activity.BookmarkComment.ProfileHeadline'] = '%1$s commented on your %8$s.';
    and
    $Definition['bookmarked discussion'] = 'bookmarked discussion';
    See Baseline locale addon or gdn_activitytype table for details.
  • I meant i.e. possessive cases.
    For instance, I'd require at least 2 translations for $Definition['bookmarked discussion'].
  • 2 translations for 1 key? Hmm... I'm afraid there's no way without core hack.
    Someone please correct me if I'm wrong.
  • Ok, my original question is something similar: where to hack the core?
  • SS ✭✭
    Someone please correct me if I'm wrong.
    It is possible by plugin. But only for different pages.
Sign In or Register to comment.