Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
25eeff4f
Commit
25eeff4f
authored
10 years ago
by
Tommaso Basilici
Browse files
Options
Downloads
Patches
Plain Diff
first commit to fix issue #2584 - checks for duplicate lang strings across all en_US lang files
parent
deb62f1f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dev/translation/sanity_check_en_langfiles.php
+60
-0
60 additions, 0 deletions
dev/translation/sanity_check_en_langfiles.php
with
60 additions
and
0 deletions
dev/translation/sanity_check_en_langfiles.php
0 → 100644
+
60
−
0
View file @
25eeff4f
<?php
/* Copyright (c) 2015 Lorenzo Novaro <novalore@19.coop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// directory containing the english lang files
$workdir
=
"../../htdocs/langs/en_US/"
;
$files
=
scandir
(
$workdir
);
$exludefiles
=
array
(
'.'
,
'..'
,
'README'
);
$files
=
array_diff
(
$files
,
$exludefiles
);
$langstrings_3d
=
array
();
$langstrings_full
=
array
();
foreach
(
$files
AS
$file
)
{
$path_file
=
pathinfo
(
$file
);
// we're only interested in .lang files
if
(
$path_file
[
'extension'
]
==
'lang'
)
{
$content
=
file
(
$workdir
.
$file
);
foreach
(
$content
AS
$line
=>
$row
)
{
// don't want comment lines
if
(
substr
(
$row
,
0
,
1
)
!==
'#'
)
{
// don't want lines without the separator (why should those even be here, anyway...)
if
(
strpos
(
$row
,
'='
)
!==
false
)
{
$row_array
=
explode
(
'='
,
$row
);
$langstrings_3d
[
$path_file
[
'basename'
]][
$line
+
1
]
=
$row_array
[
0
];
$langstrings_full
[]
=
$row_array
[
0
];
}
}
}
}
}
foreach
(
$langstrings_3d
AS
$filename
=>
$file
)
{
foreach
(
$file
AS
$linenum
=>
$value
)
{
$keys
=
array_keys
(
$langstrings_full
,
$value
);
if
(
count
(
$keys
)
>
1
)
{
foreach
(
$keys
AS
$key
)
{
$dups
[
$value
][
$filename
]
=
$linenum
;
}
}
}
}
echo
"<h2>Duplicate strings in lang files in
$workdir
</h2>"
;
echo
"<pre>"
;
print_r
(
$dups
);
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment