NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
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
check_translations.rb
#!/usr/bin/env ruby

MASTER="en-gb"

DIR = "#{__dir__}/.."

keys = %x[sed -r 's/.*(\\['.*'\\]\\['.*'\\]).*/\\1/g' #{DIR}/data/web/lang/lang.#{MASTER}.php | grep  '^\\\[' | sed 's/\\[/\\\\[/g' | sed 's/\\]/\\\\]/g'|sort | uniq]

not_used_in_php = []
keys.split("\n").each do |key|
  %x[git grep "#{key}" -- #{DIR}/data/web/*.php #{DIR}/data/web/inc #{DIR}/data/web/modals]
  if $?.exitstatus > 0
    not_used_in_php << key
  end
end

# \['user'\]\['username'\]
# \['user'\]\['waiting'\]
# \['warning'\]\['spam_alias_temp_error'\]

not_used = []
not_used_in_php.each do |string|
  section = string.scan(/([a-z]+)/)[0][0]
  key     = string.scan(/([a-z]+)/)[1][0]
  %x[git grep lang.#{key} -- #{DIR}/data/web/js/#{section}.js #{DIR}/data/web/js/debug.js]
  if $?.exitstatus > 0
    not_used << string
  end
end

puts "# Remove unused translation keys:"
not_used.each do |key|
  puts "sed -i \"/\\$lang#{key}.*;/d\" data/web/lang/lang.??.php"
end