Class: GamesAndRpgParadise::BaldursGate::RemoveNonEnglishLanguages

Inherits:
GamesAndRpgParadise::Base show all
Defined in:
lib/games_and_rpg_paradise/games/baldurs_gate/remove_non_english_languages.rb

Overview

GamesAndRpgParadise::BaldursGate::RemoveNonEnglishLanguages

Constant Summary collapse

ARRAY_CHECK_THESE_DIRECTORIES =
#

ARRAY_CHECK_THESE_DIRECTORIES

#
%w(
  tra
  Translations
  translations
  Language
  languages
)

Constants included from GamesAndRpgParadise::Base::Extensions::Colours

GamesAndRpgParadise::Base::Extensions::Colours::ARRAY_AVAILABLE_KONSOLE_COLOURS

Constants included from CommonExtensions

CommonExtensions::CONTROL_C_CODE, CommonExtensions::N

Instance Method Summary collapse

Methods included from GamesAndRpgParadise::Base::Extensions::Colours

ecomment, #efancy, #eparse, #forestgreen, #gold, #grey, #lightblue, #mediumseagreen, #mediumslateblue, #peru, #rev, sdir, sfancy, #sfile, simp, #teal, #yellow

Methods included from GamesAndRpgParadise::Base::Extensions::CommandlineArguments

#commandline_arguments?, #filter_away_commandline_arguments, #first_argument?, #first_non_hyphened_argument?, #set_commandline_arguments

Methods included from CommonExtensions

#cat, #cd, #cliner, #copy_file, #delete, #dirname_but_retains_the_trailing_slash, #disable_colours, #ensure_that_the_log_directory_exists, #esystem, #get_user_input, #infer_the_namespace, #is_on_roebe?, #log_dir?, #mkdir, #mkdir_then_cd_into_it, #mv, #namespace?, #opne, #opnn, #project_base_directory?, #project_image_directory?, #project_yaml_directory?, #rds, #register_sigint, #remove_this_directory, #rename_file, #reset, #reset_the_internal_hash, #return_pwd, #return_today, #touch_file, #wrap, #write_what_into

Constructor Details

#initialize(i = ARGV, run_already = true) ⇒ RemoveNonEnglishLanguages

#

initialize

#


39
40
41
42
43
44
45
# File 'lib/games_and_rpg_paradise/games/baldurs_gate/remove_non_english_languages.rb', line 39

def initialize(
    i           = ARGV,
    run_already = true
  )
  set_commandline_arguments(i)
  run if run_already
end

Instance Method Details

#check_for_this_directory_containing_translations(i = 'tra') ⇒ Object

#

check_for_this_directory_containing_translations

#


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/games_and_rpg_paradise/games/baldurs_gate/remove_non_english_languages.rb', line 50

def check_for_this_directory_containing_translations(i = 'tra')
  if File.directory? i
    all_directories = Dir['*'].select {|entry| File.directory? entry }
    if all_directories.include? i
      cd i
      all_directories = Dir['*'].select {|entry| File.directory? entry }
      all_directories.each {|this_directory|
        case this_directory
        when 'en_US',
             /^english$/i, # This is also valid for "English".
             /^iconv/i # iconv must be kept as weidu otherwise complains.
          # e 'Keeping '+File.absolute_path(this_directory)+'.'
        else # This may have to be changed lateron.
          e rev+'Removing '+sfancy(File.absolute_path(this_directory))+rev+'.'
          remove_this_directory(File.absolute_path(this_directory), :be_quiet)
        end
      }
    end
  end
end

#runObject

#

run

#


74
75
76
77
78
79
80
81
82
83
84
# File 'lib/games_and_rpg_paradise/games/baldurs_gate/remove_non_english_languages.rb', line 74

def run
  e rev+'Checking for tra-files in differently named directories next.'
  menu
  # ======================================================================= #
  # 'Language' and 'languages' are for Tales of Anegh, or Trials of
  # the Luremaster, respectively.
  # ======================================================================= #
  ARRAY_CHECK_THESE_DIRECTORIES.each {|this_directory_name|
    check_for_this_directory_containing_translations(this_directory_name)
  }
end