• Resolved christianrabenstein

    (@christianrabenstein)


    Translation to German does not work for ?%1$s %2$ss of access‘

    Source code

    /includes/models/model.llms.access.plan.php:294
    %1$s %2$s of access
    %1$s %2$ss of access

    %2$ is always translated with the keyword year | month | day | week
    I can not find a way to translate this keyword in the .po file.

    That’s why I’ve looked at the source code and wrote a quick and simple solution that is enough for my purposes, but this should be a translation for one and many, so that it can work also with ‘weeks’ (?Wochen‘ in german).

    $r = sprintf( _nx( '%1$s %2$s of access', '%1$s %2$ss of access', $this->get( 'access_length' ), 'Access period', 'lifterlms' ), $this->get( 'access_length' ), __($this->get( 'access_period' ),'lifterlms') );

    Because ?Wochen‘ (=weeks) ends in the majority with ‘n’ all others end in the majority with ‘e’, ??therefore you can not simply add a letter behind the singular word.

    For a better overview, the English and the corresponding German version.

    1 year access   = 1 Jahr Zugang
    7 years access  = 7 Jahre Zugang
    
    1 month access  = 1 Monat Zugang
    7 months access = 7 Monate Zugang
    
    1 week access   = 1 Woche Zugang
    7 weeks access  = 7 Wochen Zugang
    
    1 day access    = 1 Tag Zugang
    7 days access   = 7 Tage Zugang

    If you need more information, please let me know.

    best
    Christian

Viewing 3 replies - 1 through 3 (of 3 total)
  • @christianrabenstein,

    Thank you so much for all this information, I think this is an issue of my own ignorance as a developer not an actual translation issue.

    I am going go consult with a few of our translators and do my best to get a patch out to resolve this after speaking with them about a solution.

    Would you mind sharing the solution you’ve come up with that is working?

    Take care,

    Thread Starter christianrabenstein

    (@christianrabenstein)

    Certainly ?? here my quick and dirty version

    if(1 == $this->get( 'access_length' ) ) {
      // single translation
      $single_plural_translation = __($this->get( 'access_period' ),'lifterlms');
    } else {
      // plural translation
      // This could work if you have keywords in the .mo file for 'weeks'
      // so i can tranlate it
      // years months and days are there and it works fine
      $single_plural_translation = __($this->get( 'access_period' ).'s','lifterlms'); 
                                        
      // My solution now is quick and dirty
      if("week" == $this->get( 'access_period' ) ) {
        $single_plural_translation = 'Wochen'; 
      }
    }
    $r = sprintf( _nx( '%1$s %2$s of access', '%1$s %2$ss of access', $this->get( 'access_length' ), 'Access period', 'lifterlms' ), $this->get( 'access_length' ), $single_plural_translation );
    			

    this has been resolved in 3.4.6

    Thanks for your patience

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Translation to German does not work for ?%1$s %2$ss of access‘’ is closed to new replies.