Bug tracker

This ticket has been moved to our new tracker. Open Ticket PHPBB3-121 now.

duplicate entries in language files (fix completed in vcs)

there are more than 100 duplicate antries in language files (ie, the same language constant defined in more than 1 file).
since they are so many, i dont list them all here, but i will list the summary:

Equal: 77, Differ in case only: 10, differ in content: 27

this means that 77 of them having equal value in 2 files (example: CLOSE_WINDOW in common.php and posting.php), 10 differ only in case (example: POST_DETAILS in common and mcp), and 27 actually differ (example: SEARCH_KEYWORDS in common and search).

Comments / History

Posted by Acyd Burn (Server Manager) on Mar 21st 2006, 09:26

Some are intentional (same key but different content) - so you can substract the 27 from your calculations. Wink

But it would be still interesting to have a collection about your findings to inspect them all (are they valid, do they need to be moved, merged, removed...).

Would be nice if you could upload your list and post the link to it. Smile

Posted by arod-1 on Mar 21st 2006, 17:12

i beg to differ: if the difference in content is intentional, imho you should use a different key.
in any family, if you give two different brothers the same name, you are asking for confusion, and really, i cant see the advantage of using the same key when different content is required.
imho, every key should be used exactly once.
also, the way it is done now, creates confusion for translators.

as to the full list:
here is a little php file that find all the duplicates. i place it in the language/en directory, and run it through command line:
Code: Select all
#!/usr/local/bin/php
<?php
function find_modules($dirname) {
   $list = glob("$dirname/*.php");
   foreach(glob("$dirname/*") as $name)
      if (is_dir($name))
         $list =  array_merge($list, find_modules($name));
   return $list;
}

$modules = find_modules(".");

$kkeys = array();
$keys = array();
$langdir = dirname(__FILE__);
foreach($modules as $module) {
   require_once("$langdir/$module");
   if (isset($lang)) {
      $kkeys[$module] = $lang;
      $keys[] = $module;
      unset($lang);
   }
}
$duplicates = array();
$dupmodules = array();
$dupPerModule = array();
$equal = $case = $diff = 0;
while ($module = array_shift($keys)) {
   $keys_1 = array_keys($kkeys[$module]);
//   reset($keys);
   foreach ($keys as $other_module) {
      $keys_2 = array_keys($kkeys[$other_module]);
      foreach(array_intersect($keys_1, $keys_2) as $dup) {
         if ($kkeys[$module][$dup] == $kkeys[$other_module][$dup]) {
            $compare = "Equal";
            $equal++;
         } else if (strcasecmp($kkeys[$module][$dup], $kkeys[$other_module][$dup]) == 0) {
            $compare = "Differ in case";
            $case++;
         } else {
            $compare = "'{$kkeys[$module][$dup]}'/'{$kkeys[$other_module][$dup]}'";
            $diff++;
         }
         $duplicates[] = "$dup, $module::$other_module     $compare";
         $dupmodules["$module::$other_module"]++;
         $dupPerModule[$module]++;
         $dupPerModule[$other_module]++;
      }
   }
}

arsort($dupPerModule, SORT_NUMERIC);
echo "Starting Now!\n";
print_r($duplicates);
print_r($dupmodules);
print_r($dupPerModule);
print("Equal: $equal, Differ in case only: $case, differ in content: $diff\n");
?>


and the results:
Code: Select all
Content-type: text/html
X-Powered-By: PHP/5.0.3

Starting Now!
Array
(
    [0] => FILE_NOT_FOUND, ./common.php::./install.php     'The requested file could not be found'/'Cannot find'
    [1] => FTP_PASSWORD, ./common.php::./install.php     Equal
    [2] => FTP_USERNAME, ./common.php::./install.php     Equal
    [3] => JUMP_TO, ./common.php::./mcp.php     'Jump to'/'Moderate Forum'
    [4] => POST_DETAILS, ./common.php::./mcp.php     Differ in case
    [5] => VIEWING_PROFILE, ./common.php::./memberlist.php     'Viewing member profile'/'Viewing profile - %s'
    [6] => CLOSE_WINDOW, ./common.php::./posting.php     Differ in case
    [7] => DAYS, ./common.php::./posting.php     Equal
    [8] => SEARCH_KEYWORDS, ./common.php::./search.php     'Enter search keywords'/'Search for Keywords'
    [9] => DELETE_ALL, ./common.php::./ucp.php     Differ in case
    [10] => UNREAD_MESSAGES, ./common.php::./ucp.php     Equal
    [11] => ATTACHMENTS, ./common.php::./acp/attachments.php     Equal
    [12] => LDAP_DN, ./common.php::./acp/board.php     Equal
    [13] => LDAP_DN_EXPLAIN, ./common.php::./acp/board.php     Equal
    [14] => LDAP_SERVER, ./common.php::./acp/board.php     Equal
    [15] => LDAP_SERVER_EXPLAIN, ./common.php::./acp/board.php     Equal
    [16] => LDAP_UID, ./common.php::./acp/board.php     Equal
    [17] => LDAP_UID_EXPLAIN, ./common.php::./acp/board.php     Equal
    [18] => DISPLAY, ./common.php::./acp/common.php     Equal
    [19] => FORUM_INDEX, ./common.php::./acp/common.php     'Board Index'/'Forum Index'
    [20] => IP, ./common.php::./acp/common.php     'IP'/'User IP'
    [21] => ON, ./common.php::./acp/common.php     Differ in case
    [22] => RETURN_TO, ./common.php::./acp/common.php     'Return to'/'Return to ...'
    [23] => FOLDER, ./common.php::./acp/forums.php     Equal
    [24] => FORUM_RULES, ./common.php::./acp/forums.php     Equal
    [25] => FORUM_RULES_LINK, ./common.php::./acp/forums.php     'Please click to view the forum rules'/'Link to Forum Rules'
    [26] => SUBFORUM, ./common.php::./acp/forums.php     Equal
    [27] => GROUP_ERR_DESC_LONG, ./common.php::./acp/groups.php     Equal
    [28] => GROUP_ERR_TYPE, ./common.php::./acp/groups.php     Equal
    [29] => GROUP_ERR_USERNAME, ./common.php::./acp/groups.php     Equal
    [30] => GROUP_ERR_USER_LONG, ./common.php::./acp/groups.php     Equal
    [31] => NO_GROUP, ./common.php::./acp/groups.php     'The requested usergroup does not exist.'/'No group specified'
    [32] => NO_USERS, ./common.php::./acp/groups.php     Equal
    [33] => DELETE_ALL, ./common.php::./acp/posting.php     Differ in case
    [34] => FROM, ./common.php::./acp/styles.php     Equal
    [35] => WARNINGS, ./common.php::./acp/users.php     Equal
    [36] => GROUP_NAME, ./groups.php::./acp/attachments.php     Equal
    [37] => GROUP_AVATAR, ./groups.php::./acp/groups.php     Equal
    [38] => GROUP_CLOSED, ./groups.php::./acp/groups.php     Equal
    [39] => GROUP_DESC, ./groups.php::./acp/groups.php     Equal
    [40] => GROUP_HIDDEN, ./groups.php::./acp/groups.php     Equal
    [41] => GROUP_MEMBERS, ./groups.php::./acp/groups.php     Equal
    [42] => GROUP_NAME, ./groups.php::./acp/groups.php     Equal
    [43] => GROUP_OPEN, ./groups.php::./acp/groups.php     Equal
    [44] => GROUP_RANK, ./groups.php::./acp/groups.php     Equal
    [45] => GROUP_TYPE, ./groups.php::./acp/groups.php     Equal
    [46] => GROUP_LIST, ./groups.php::./acp/groups.php     'Manage Users'/'Current members'
    [47] => CONTACT_EMAIL, ./install.php::./acp/board.php     Equal
    [48] => SERVER_NAME, ./install.php::./acp/board.php     Differ in case
    [49] => SERVER_NAME_EXPLAIN, ./install.php::./acp/board.php     'The domain name this board runs from'/'The domain name this board runs from (for example: www.foo.bar)'
    [50] => SERVER_PORT, ./install.php::./acp/board.php     Differ in case
    [51] => SERVER_PORT_EXPLAIN, ./install.php::./acp/board.php     Equal
    [52] => DELETE_POST_CONFIRM, ./mcp.php::./posting.php     'Are you sure you want to delete this post?'/'Are you sure you want to delete this message?'
    [53] => FORK_TOPIC, ./mcp.php::./viewtopic.php     'Fork Topic'/'Copy Topic'
    [54] => UNLOCK_TOPIC, ./mcp.php::./viewtopic.php     Equal
    [55] => POSTS_PER_PAGE, ./mcp.php::./acp/board.php     Differ in case
    [56] => ACTION, ./mcp.php::./acp/common.php     Equal
    [57] => ALL_ENTRIES, ./mcp.php::./acp/common.php     Equal
    [58] => DISPLAY_LOG, ./mcp.php::./acp/common.php     Equal
    [59] => NO_ENTRIES, ./mcp.php::./acp/common.php     Equal
    [60] => SORT_ACTION, ./mcp.php::./acp/common.php     Equal
    [61] => SORT_DATE, ./mcp.php::./acp/common.php     Equal
    [62] => SORT_IP, ./mcp.php::./acp/common.php     Equal
    [63] => FORUM_DESC, ./mcp.php::./acp/forums.php     Equal
    [64] => FORUM_NAME, ./mcp.php::./acp/forums.php     Equal
    [65] => FORUM_STATUS, ./mcp.php::./acp/forums.php     Equal
    [66] => FORUM_STYLE, ./mcp.php::./acp/forums.php     Equal
    [67] => NO_DESTINATION_FORUM, ./mcp.php::./acp/forums.php     'Please select a forum for destination'/'You have not specified a forum to move content to'
    [68] => RESYNC, ./mcp.php::./acp/forums.php     'Resync'/'Sync'
    [69] => DELETE_POSTS, ./mcp.php::./acp/users.php     Equal
    [70] => SELECT_USER, ./mcp.php::./acp/users.php     Differ in case
    [71] => GROUP_LEADER, ./memberlist.php::./ucp.php     'Group leader'/'Leaderships'
    [72] => RECIPIENT, ./memberlist.php::./ucp.php     Equal
    [73] => EMAIL_SENT, ./memberlist.php::./acp/email.php     'The email has been sent.'/'Your message has been queued for sending.'
    [74] => LAST_ACTIVE, ./memberlist.php::./acp/users.php     Equal
    [75] => DELETE_MESSAGE, ./posting.php::./ucp.php     Equal
    [76] => DELETE_MESSAGE_CONFIRM, ./posting.php::./ucp.php     'Are you sure you want to delete this message?'/'Are you sure you want to delete this private message?'
    [77] => MESSAGE_DELETED, ./posting.php::./ucp.php     'Your message has been deleted successfully'/'Message successfully deleted'
    [78] => SAVE, ./posting.php::./acp/profile.php     Equal
    [79] => ADMIN_EMAIL, ./ucp.php::./acp/board.php     'Administrators can email me information'/'Return Email Address'
    [80] => HOLD_NEW_MESSAGES, ./ucp.php::./acp/board.php     'Do not accept new messages (New messages will be held back until enough space is available)'/'Hold new messages'
    [81] => REGISTRATION, ./ucp.php::./acp/board.php     'Registration'/'User Registration'
    [82] => ADD, ./ucp.php::./acp/common.php     Equal
    [83] => MOVE_DOWN, ./ucp.php::./acp/common.php     Differ in case
    [84] => MOVE_UP, ./ucp.php::./acp/common.php     Differ in case
    [85] => UCP, ./ucp.php::./acp/common.php     Equal
    [86] => GROUP_PENDING, ./ucp.php::./acp/groups.php     'Pending memberships'/'Pending Members'
    [87] => GROUP_DETAILS, ./ucp.php::./acp/groups.php     Equal
    [88] => DELETE_ALL, ./ucp.php::./acp/posting.php     Equal
    [89] => CURRENT_IMAGE, ./ucp.php::./acp/styles.php     Equal
    [90] => CONFIRM_EMAIL_EXPLAIN, ./ucp.php::./acp/users.php     'You only need to specify this if you are changing your email address.'/'You only need to specify this if you are changing the users email address.'
    [91] => CODE, ./viewtopic.php::./acp/posting.php     Equal
    [92] => CREATE_GROUP, ./acp/attachments.php::./acp/groups.php     Equal
    [93] => GROUP_NAME, ./acp/attachments.php::./acp/groups.php     Equal
    [94] => NO_IMAGE, ./acp/attachments.php::./acp/styles.php     Equal
    [95] => IP_HOSTNAME, ./acp/ban.php::./acp/common.php     Equal
    [96] => DEFAULT_STYLE, ./acp/board.php::./acp/forums.php     Equal
    [97] => ACP_RESTORE, ./acp/common.php::./acp/database.php     Equal
    [98] => DEACTIVATE, ./acp/common.php::./acp/prune.php     Equal
    [99] => ACP_SEARCH_SETTINGS, ./acp/common.php::./acp/search.php     Equal
    [100] => DIMENSIONS, ./acp/common.php::./acp/styles.php     'Dimensions'/'Include dimensions'
    [101] => ALL_USERS, ./acp/email.php::./acp/permissions.php     'All Users'/'Select all users'
    [102] => COPY_PERMISSIONS, ./acp/forums.php::./acp/groups.php     Equal
    [103] => COPY_PERMISSIONS_EXPLAIN, ./acp/forums.php::./acp/groups.php     'Once created, the forum will have the same permissions as the one you select here. If no forum is selected the newly created forum will not be visible until permissions had been set.'/'Once created, the group will have the same permissions as the one you select here.'
    [104] => NO_PERMISSIONS, ./acp/forums.php::./acp/groups.php     Equal
    [105] => NO_PARENT, ./acp/forums.php::./acp/modules.php     Equal
    [106] => PRUNE_ANNOUNCEMENTS, ./acp/forums.php::./acp/prune.php     Equal
    [107] => PRUNE_STICKY, ./acp/forums.php::./acp/prune.php     Equal
    [108] => PRUNE_OLD_POLLS, ./acp/forums.php::./acp/prune.php     Equal
    [109] => PRUNE_OLD_POLLS_EXPLAIN, ./acp/forums.php::./acp/prune.php     Equal
    [110] => ADD_USERS, ./acp/groups.php::./acp/permissions.php     Equal
    [111] => GROUP_DEFAULT, ./acp/groups.php::./acp/users.php     Equal
    [112] => GROUP_DELETE, ./acp/groups.php::./acp/users.php     Equal
    [113] => GROUP_DEMOTE, ./acp/groups.php::./acp/users.php     Equal
    [114] => GROUP_PROMOTE, ./acp/groups.php::./acp/users.php     Equal
)
Array
(
    [./common.php::./install.php] => 3
    [./common.php::./mcp.php] => 2
    [./common.php::./memberlist.php] => 1
    [./common.php::./posting.php] => 2
    [./common.php::./search.php] => 1
    [./common.php::./ucp.php] => 2
    [./common.php::./acp/attachments.php] => 1
    [./common.php::./acp/board.php] => 6
    [./common.php::./acp/common.php] => 5
    [./common.php::./acp/forums.php] => 4
    [./common.php::./acp/groups.php] => 6
    [./common.php::./acp/posting.php] => 1
    [./common.php::./acp/styles.php] => 1
    [./common.php::./acp/users.php] => 1
    [./groups.php::./acp/attachments.php] => 1
    [./groups.php::./acp/groups.php] => 10
    [./install.php::./acp/board.php] => 5
    [./mcp.php::./posting.php] => 1
    [./mcp.php::./viewtopic.php] => 2
    [./mcp.php::./acp/board.php] => 1
    [./mcp.php::./acp/common.php] => 7
    [./mcp.php::./acp/forums.php] => 6
    [./mcp.php::./acp/users.php] => 2
    [./memberlist.php::./ucp.php] => 2
    [./memberlist.php::./acp/email.php] => 1
    [./memberlist.php::./acp/users.php] => 1
    [./posting.php::./ucp.php] => 3
    [./posting.php::./acp/profile.php] => 1
    [./ucp.php::./acp/board.php] => 3
    [./ucp.php::./acp/common.php] => 4
    [./ucp.php::./acp/groups.php] => 2
    [./ucp.php::./acp/posting.php] => 1
    [./ucp.php::./acp/styles.php] => 1
    [./ucp.php::./acp/users.php] => 1
    [./viewtopic.php::./acp/posting.php] => 1
    [./acp/attachments.php::./acp/groups.php] => 2
    [./acp/attachments.php::./acp/styles.php] => 1
    [./acp/ban.php::./acp/common.php] => 1
    [./acp/board.php::./acp/forums.php] => 1
    [./acp/common.php::./acp/database.php] => 1
    [./acp/common.php::./acp/prune.php] => 1
    [./acp/common.php::./acp/search.php] => 1
    [./acp/common.php::./acp/styles.php] => 1
    [./acp/email.php::./acp/permissions.php] => 1
    [./acp/forums.php::./acp/groups.php] => 3
    [./acp/forums.php::./acp/modules.php] => 1
    [./acp/forums.php::./acp/prune.php] => 4
    [./acp/groups.php::./acp/permissions.php] => 1
    [./acp/groups.php::./acp/users.php] => 4
)
Array
(
    [./common.php] => 36
    [./acp/groups.php] => 28
    [./acp/common.php] => 21
    [./mcp.php] => 21
    [./acp/forums.php] => 19
    [./ucp.php] => 19
    [./acp/board.php] => 16
    [./groups.php] => 11
    [./acp/users.php] => 9
    [./install.php] => 8
    [./posting.php] => 7
    [./acp/attachments.php] => 5
    [./memberlist.php] => 5
    [./acp/prune.php] => 5
    [./acp/styles.php] => 4
    [./viewtopic.php] => 3
    [./acp/posting.php] => 3
    [./acp/email.php] => 2
    [./acp/permissions.php] => 2
    [./acp/modules.php] => 1
    [./acp/search.php] => 1
    [./acp/database.php] => 1
    [./acp/profile.php] => 1
    [./acp/ban.php] => 1
    [./search.php] => 1
)
Equal: 77, Differ in case only: 11, differ in content: 27

(note that a new duplicate was added since original report)

Linked ticket with changeset: r5904

Action performed by naderman (Development Team Leader) on May 12th 2006, 23:45

Posted by naderman (Development Team Leader) on May 12th 2006, 23:53

Thanks for the little script Wink

Posted by arod-1 on May 15th 2006, 15:36

why is this bug "closed"? there are still dozens of duplicates, no?

Posted by naderman (Development Team Leader) on May 15th 2006, 22:48

Because most duplicates which really conflicted are resolved. I checked the script into CVS for future checking and possibly changing of keys. Some have an identical key on purpose as Meik mentioned above. The filename gives the context so there isn't anything fundamentally wrong with it.

Ticket details

Related SVN changesets