Things you should be aware of before starting Revive Adserver development.
Revive Adserver, as a project, has been around for a very long time, and as a result, some of the language that you will find used the code base will often not align with the language used in the UI, as the terms used in online advertising have changed over the decades.
The following is list of historical terms that may be helpful to be aware of when reading code/comments in code.
Current UI Terminology
Previous Terminology In Code
Delivery Rule Sets
Coding Best Practices
When writing code that is executed as part of the process of delivering banners, it is important that warnings etc. that may be thrown by code are not displayed as output, as it is obviously not desirable to display these in the browser when displaying a banner. (Displaying warnings in the Revive Adserver UI is not ideal, but at least it will help users know what the problem is. Showing warnings about problems instead of a banner is very bad.)
Accordingly, if methods/functions called in delivery engine code could throw warnings etc., these should be suppressed / handled as appropriate, to ensure that they are not displayed to the UI.
This means that if you think a translation used in the user interface for any language other than English is incorrect, please create an account with Crowdin, and suggest a new translation there. Accepted translations are periodically merged by the core Revive Adserver team into the master branch of Revive Adserver, and will be included in the next release.
However, if you think that:
A master English translation needs to be changed (e.g. to reflect changed functionality);
A new master English translation key needs to be added (e.g. to reflect new functionality); or
A master English translation key needs to be removed (e.g. to reflect removed functionality)
then these changes should all be performed as a change in the master branch.
The changes to the master English files are automatically imported into the Crowdin project. Translations in languages other English will be automatically updated to reflect the added or out of date translations that need to be corrected, and to remove any keys no longer required.
Apart from translations for plugins, all translation files for Revive Adserver can be found in the directories under lib/max/language.
Updating the master English translations for plugins is a little more complex than just editing a text file - please see the page on Plugin Translations for details on how to do this.
Once the master English translations in a plugin are updated, though, the changes are still automatically imported into Crowdin for translation into other languages.
Translation Strings in PHP Code
In PHP code, to obtain a correctly translated string for display to a user, based on their settings, use the OX_Translation class:
In Smarty template code, to obtain a correctly translated string for display to a user, based on their settings, use the t function:
The translation key used in the examples excludes the "str" prefix used in the translation files. That is, in both the PHP and Smarty Template examples opposite, the code would be for the following entry in the translation files:
$GLOBALS['strTargetString'] = "Target String";
Numeric, Date, and Time Formats in Code
In Revive Adserver, there are no options for users to define how they want number, date, and time values to be formatted. Instead, the formats for all of these are based on the language selected.
To format numbers, use the OA_Admin_NumberFormat class: