Helix Core is now P4 and Helix Swarm is now P4 Code Review. Product user interfaces will be updated soon. Learn more >>

Documentation | 2025.5

# Localization & UTF8 character display

To ensure that all characters, including Unicode characters, are displayed and handled correctly by P4 Code Review, configure your P4 Server in Unicode mode. For information on configuring your P4 Server in Unicode mode, see Set up and manage Unicode installations in the P4 Server Administration Documentation.

If you make a configuration change, P4 Code Review will not use it until the configuration cache has been reloaded, this forces P4 Code Review to use the new configuration.

You must be an admin or super user to reload the P4 Code Review config cache. Navigate to the User id dropdown menu, select System Information, click the Cache Info tab, and click the Reload Configuration button.

P4 Code Review supports localization and the display of some non-UTF8 characters.

## Localization

If you are using a web browser that uses the en-US locale, P4 Code Review will automatically redirect to en to get locale files.

P4 Code Review is fully localized; with an appropriate language pack installation, P4 Code Review can support users in multiple languages.

A language pack consists of `gettext-style` `default.po` and `default.mo` files, placed in a folder named for the locale they represent, within the language folder in the P4 Code Review root directory. In addition, language packs contain two JavaScript files to provide translation strings for the in-browser UI, `locale.js` and `locale.jsgz`, which both appear in the `SWARM_ROOT/public/build/language` folder.

The following example illustrates the directory layout of a language pack:

    SWARM_ROOT/
        language/
            locale/
                default.mo
                default.po
        public/
            build/
                language/
                    locale.js
                    locale.jsgz

You can configure certain localization behaviors with the `translator` configuration block in the `SWARM_ROOT/data/config.php` file. Here is an example:

    <?php
        // this block should be a peer of 'p4'
        'translator' => array(
            'detect_locale'              => true,
            'locale'                     => "",
            'translation_file_patterns'  => array(),
        ),

The `detect_locale` key determines whether P4 Code Review attempts to detect the browser's locale. The default value is `true`. Set the value to `false` to disable browser locale detection.

The `locale` key is a string specifying the default locale for P4 Code Review. Alternately, an array of 2 strings can be used to specify the default locale, and a fallback locale. For example:

    <?php
        // this block should be a peer of 'p4'
        'translator' => array(
            'locale'                     => array("en_GB", "en_US"),
        ),

The `translation_file_patterns` key allows you to customize the Laminas translation infrastructure, which you might do if you are developing your own language pack. For details, see Laminas\I18n.

P4 Code Review supports the Laminas component versions in the LICENSE.txt file, features and functions in the Laminas documentation that were introduced in later versions of Laminas will not work with P4 Code Review. The LICENSE.txt file is in the readme folder of your P4 Code Review installation.

## Non-UTF8 character display

P4 Code Review supports the display of non-UTF8 characters in file content when all of the following are true:

- The P4 Server is Unicode enabled.
- The character encoding is supported by P4 Code Review.
- The character encoding is listed in the translator array.

Multiple character encodings can be specified in the array, if P4 Code Review fails to find a matching encoding in the array it will fall back to windows-1252. Unsupported and invalid character encodings in the array are ignored.

For information on character encodings supported by P4 Code Review, see Supported Character Encodings.

Configure character encodings by adding the following block to the `SWARM_ROOT/data/config.php` file. For example:

    <?php
        // this block should be a peer of 'p4'
        'translator' => array(
            'non_utf8_encodings' => array('sjis', 'euc-jp', 'windows-1252'),
        ),

windows-1252 is the default character encoding, it must always be the last entry in the array.

## UTF8 conversion

If P4 Code Review is connected to a non-unicode enabled P4 Server, P4 Code Review converts special characters to UTF8 by default. For ANSI and ASCII files, this can result in some special characters being displayed in the diff view incorrectly or not at all. To stop P4 Code Review converting special characters to UTF8 and to display special characters as unknown (�), disable UTF8 conversion by setting utf8_convert to false.

Disable UTF8 character conversion by adding the following block to the `SWARM_ROOT/data/config.php` file. For example:

    <?php
        // this block should be a peer of 'p4'
        'translator' => array(
            'utf8_convert' => false,
        ),

By default, the value of this configurable is true.

Your search for returned results