public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Trace
helper-scripts/check_translations.rb
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
#!/usr/bin/env ruby
3
MASTER="en-gb"
5
DIR = "#{__dir__}/.."
7
keys = %x[sed -r 's/.*(\\['.*'\\]\\['.*'\\]).*/\\1/g' #{DIR}/data/web/lang/lang.#{MASTER}.php | grep '^\\\[' | sed 's/\\[/\\\\[/g' | sed 's/\\]/\\\\]/g'|sort | uniq]
9
not_used_in_php = []
10
keys.split("\n").each do |key|
11
%x[git grep "#{key}" -- #{DIR}/data/web/*.php #{DIR}/data/web/inc #{DIR}/data/web/modals]
12
if $?.exitstatus > 0
13
not_used_in_php << key
14
end
15
end
17
# \['user'\]\['username'\]
18
# \['user'\]\['waiting'\]
19
# \['warning'\]\['spam_alias_temp_error'\]
21
not_used = []
22
not_used_in_php.each do |string|
23
section = string.scan(/([a-z]+)/)[0][0]
24
key = string.scan(/([a-z]+)/)[1][0]
25
%x[git grep lang.#{key} -- #{DIR}/data/web/js/#{section}.js #{DIR}/data/web/js/debug.js]
26
if $?.exitstatus > 0
27
not_used << string
28
end
29
end
31
puts "# Remove unused translation keys:"
32
not_used.each do |key|
33
puts "sed -i \"/\\$lang#{key}.*;/d\" data/web/lang/lang.??.php"
34
end