View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012303 | mantisbt | localization | public | 2010-08-27 14:15 | 2010-08-27 14:15 |
| Reporter | dregad | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | new | Resolution | open | ||
| Product Version | 1.2.1 | ||||
| Summary | 0012303: custom_strings_inc.php called twice for English, resulting in wrong initialization of translation | ||||
| Description | I have added a new severity to g_severity_enum_string, and following the documentation for custom enumerations, I created a custom_constant_inc.php for the new value, and a custom_strings_inc.php to initialize the translation properly. I wanted to make it generic, to avoid having the @55@ code appearing for unhandled languages, so I tried to use a regexp function instead of a simple assignment, like this: $s_severity_enum_string = preg_replace($s_search, $s_replace, $s_severity_enum_string); This worked perfectly for all languages, except for English (default in config_default_inc.php), where $s_severity_enum_string was empty. After some research, I realized that custom_strings_inc.php is actually called multiple times :
Obviously I have an easy workaround to this, by doing a simple assignment to the variable, but I do not understand why the custom_strings_inc.php is called twice for English. Is this normal behavior ? | ||||
| Steps To Reproduce | Create a dummy custom_strings_inc.php as follows: <?php On top of every loaded page, you will see english - 10:feature,20:trivial,30:text,40:tweak,50:minor,60:major,70:crash,80:block | ||||
| Additional Information | For reference, here is my actual code (left only French language as an example) <?php switch ( $g_active_language ) {
} Insert the translation string in the right place, between minor and major$s_search = "/(" . MINOR . ":[^,]+),(" . MAJOR . ":)/i"; ?> | ||||
| Tags | No tags attached. | ||||