[PhpBB] Ajouter des séparateurs de milliers

Il n'existe apparemment pas de solution simple pour ajouter des séparateurs de milliers à un forum phpBB 3.2, j'ai donc pris le temps de rechercher ce qu'il fallait modifier pour ajouter ces séparateurs sur le forum et je vais maintenant partager ces informations avec vous.

La technique consiste à mettre en forme ces nombres dans les différents fichiers avec la fonction PHP number_format.

N'oubliez pas de faire une copie de vos fichiers pour plus de sécurité.


Liste des forums (nombre de sujets, messages)

Dans le fichier "includes/functions_display.php", trouvez :

            'TOPICS'		=> $row['forum_topics'],
            $l_post_click_count	=> $post_click_count,

Et remplacez par :

            'TOPICS'		=> number_format($row['forum_topics'], 0, '.', '\''),
            $l_post_click_count	=> number_format($post_click_count, 0, '.', '\''),

Liste des topics (nombre de réponses, vues)

Dans le fichier "viewforum.php", trouvez :

            'REPLIES'	=> $replies,
            'VIEWS'	=> $row['topic_views'],

Et remplacez par :

            'REPLIES'	=> number_format($replies, 0, '.', '\''),
            'VIEWS'	=> number_format($row['topic_views'], 0, '.', '\''),

Statistiques en bas de l'index (nombre de messages, sujets, membres)

Dans le fichier "index.php", trouvez :

// Assign index specific vars
$template->assign_vars(array(
    'TOTAL_POSTS'	=> $user->lang('TOTAL_POSTS_COUNT', (int) $config['num_posts']),
    'TOTAL_TOPICS'	=> $user->lang('TOTAL_TOPICS', (int) $config['num_topics']),
    'TOTAL_USERS'	=> $user->lang('TOTAL_USERS', (int) $config['num_users']),

Et remplacez par :

// Assign index specific vars
$template->assign_vars(array(
    'TOTAL_POSTS'	=> $user->lang('TOTAL_POSTS_COUNT', number_format($config['num_posts'], 0, '.', '\'')),
    'TOTAL_TOPICS'	=> $user->lang('TOTAL_TOPICS', number_format($config['num_topics'], 0, '.', '\'')),
    'TOTAL_USERS'	=> $user->lang('TOTAL_USERS', number_format($config['num_users'], 0, '.', '\'')),

Dans le fichier "language/en/common.php", trouvez :

    'TOTAL_POSTS_COUNT'	=> array(
        2	=> 'Total posts <strong>%d</strong>',
    ),
    'TOPIC_REPORTED'	=> 'This topic has been reported',
    'TOTAL_TOPICS'	=> array(
        2	=> 'Total topics <strong>%d</strong>',
    ),
    'TOTAL_USERS'	=> array(
        2	=> 'Total members <strong>%d</strong>',
    ),

Et remplacez par :

    'TOTAL_POSTS_COUNT'	=> array(
        2	=> 'Total posts <strong>%s</strong>',
    ),
    'TOPIC_REPORTED'	=> 'This topic has been reported',
    'TOTAL_TOPICS'	=> array(
        2	=> 'Total topics <strong>%s</strong>',
    ),
    'TOTAL_USERS'	=> array(
        2	=> 'Total members <strong>%s</strong>',
    ),

Dans le fichier "language/fr/common.php", trouvez :

    'TOTAL_POSTS_COUNT'	=> array(
        2	=> '<strong>%d</strong> messages',
    ),
    'TOPIC_REPORTED'	=> 'Ce sujet a été rapporté',
    'TOTAL_TOPICS'	=> array(
        2	=> '<strong>%d</strong> sujets',
    ),
    'TOTAL_USERS'	=> array(
        2	=> '<strong>%d</strong> membres',
    ),

Et remplacez par :

    'TOTAL_POSTS_COUNT'	=> array(
        2	=> '<strong>%s</strong> messages',
    ),
    'TOPIC_REPORTED'	=> 'Ce sujet a été rapporté',
    'TOTAL_TOPICS'	=> array(
        2	=> '<strong>%s</strong> sujets',
    ),
    'TOTAL_USERS'	=> array(
        2	=> '<strong>%s</strong> membres',
    ),

Nombre de messages des membres (dans viewtopic)

Dans le fichier "viewtopic.php", trouvez :

        'POSTER_POSTS'	=> $user_cache[$poster_id]['posts'],

Et remplacez par :

        'POSTER_POSTS'	=> empty($user_cache[$poster_id]['posts']) ? '' : number_format($user_cache[$poster_id]['posts'], 0, '.', '\'')),