1
zivXP
Rating in publisher
  • 2023/2/28 9:05

  • zivXP

  • Not too shy to talk

  • Posts: 113

  • Since: 2006/2/9 1


How to change a language variable?
define('_MD_PUBLISHER_VOTE_VOTE', 'voice');
define('_MD_PUBLISHER_VOTE_VOTES', 'voices');
define('_MD_PUBLISHER_VOTE_VOTESS', 'voicess');

As I understand it, you need to edit the file ajax_rating.php?

1 - voice
2-4 - voices
5+ -voicess

How can this be changed?
$tense = 1 == $count ? _MD_PUBLISHER_VOTE_VOTE : _MD_PUBLISHER_VOTE_VOTES; //plural form votes/vote

2
Mamba
Re: Rating in publisher
  • 2023/2/28 17:08

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


You were not clear about what you want to change - is it the translation, or the name of the variable?

You can change the translation in the language file: /modules/publisher/language/russian/main.php

Tell us more about the issue and the desired outcome of the change?
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

3
zivXP
Re: Rating in publisher
  • 2023/2/28 17:20

  • zivXP

  • Not too shy to talk

  • Posts: 113

  • Since: 2006/2/9 1


Kind people who are called programmers helped me here.
This code needs to be replaced in the files Utility.php, ajax_rating.php
$tense == $count _MD_PUBLISHER_VOTE_VOTE _MD_PUBLISHER_VOTE_VOTES//plural form votes/vote


with this one:
// Change to define Russian word endings
function getTense($n$one$two$more)
{
      
$n $n 100;
    if (
10 $n && 20 $n) {
        return 
$more;
    }
    
$n $n 10;
    if (
== $n) {
        return 
$one;
    }
    if (
<= $n && >= $n) {
        return 
$two;
    }
    return 
$more;
}
$tense getTense($count_MD_PUBLISHER_VOTE_VOTE_MD_PUBLISHER_VOTE_VOTES_MD_PUBLISHER_VOTE_VOTESS); //plural form votes/vote


I've already tested it. Everything works correctly.
1 голос
2,3,4 голоса
5-20 голосов
21 - голос
22,23,24 голоса
25-30 голосов
and further
There are still exceptions. They are also taken into account in this code.

4
zivXP
Re: Rating in publisher
  • 2023/2/28 18:59

  • zivXP

  • Not too shy to talk

  • Posts: 113

  • Since: 2006/2/9 1



5
Mamba
Re: Rating in publisher
  • 2023/3/1 7:30

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Thank you so much for sharing the code!

I'll include it in the next version of Publisher. Please share the name of your programmers, so we can give them credit.
Or they can submit the changes directly to us via GitHub.

Your website looks nice, and I'm glad that plurals are now working for you.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

6
zivXP
Re: Rating in publisher
  • 2023/3/1 8:01

  • zivXP

  • Not too shy to talk

  • Posts: 113

  • Since: 2006/2/9 1


These people don't have a name. I asked on this forum.
https://www.cyberforum.ru/php-beginners/thread3085052.html

This is probably already an established function.
In different languages there is a different algorithm for changing endings with numerals.
I don't know how it's possible to take everything into account. Is it possible?

Login

Who's Online

309 user(s) are online (92 user(s) are browsing Support Forums)


Members: 0


Guests: 309


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits