[kde-doc-english] [releaseme/rewrite] /: documentation goes to en rather than en_US wouldn't you know it

Harald Sitter sitter at kde.org
Fri Feb 20 14:22:54 UTC 2015


Git commit bffd2bd05b5869c09a5031675e4b04a8c41bb5b6 by Harald Sitter.
Committed on 20/02/2015 at 13:15.
Pushed by sitter into branch 'rewrite'.

documentation goes to en rather than en_US wouldn't you know it

M  +7    -7    lib/cmakeeditor.rb
M  +7    -7    lib/documentation.rb
R  +0    -0    test/data/cmakeeditor/test_create_handbook_complex/en/CMakeLists.txt [from: test/data/cmakeeditor/test_create_handbook_complex/en_US/CMakeLists.txt - 100% similarity]
R  +0    -0    test/data/cmakeeditor/test_create_handbook_complex/en/doc1/index.docbook [from: test/data/cmakeeditor/test_create_handbook_complex/en_US/doc1/index.docbook - 100% similarity]
R  +0    -0    test/data/cmakeeditor/test_create_handbook_complex/en/doc2/index.docbook [from: test/data/cmakeeditor/test_create_handbook_complex/en_US/doc2/index.docbook - 100% similarity]
R  +0    -0    test/data/cmakeeditor/test_create_handbook_complex/en/doc3/CMakeLists.txt [from: test/data/cmakeeditor/test_create_handbook_complex/en_US/doc3/CMakeLists.txt - 100% similarity]
R  +0    -0    test/data/cmakeeditor/test_create_handbook_complex/en/doc3/doc3.1/index.docbook [from: test/data/cmakeeditor/test_create_handbook_complex/en_US/doc3/doc3.1/index.docbook - 100% similarity]
M  +18   -18   test/test_cmakeeditor.rb
M  +21   -21   test/test_documentation.rb

http://commits.kde.org/releaseme/bffd2bd05b5869c09a5031675e4b04a8c41bb5b6

diff --git a/lib/cmakeeditor.rb b/lib/cmakeeditor.rb
index 4d9fc0e..999ebe3 100644
--- a/lib/cmakeeditor.rb
+++ b/lib/cmakeeditor.rb
@@ -51,24 +51,24 @@ kdoctools_create_handbook(index.docbook
   end
 
   # Creates the CMakeLists.txt for doc/$LANG/*
-  # FIXME: don't overwrite en_US' CMakeLists.txt for a given subdir
+  # FIXME: don't overwrite en' CMakeLists.txt for a given subdir
   def create_language_specific_doc_lists!(dir, language, software_name)
     if File.exist?("#{dir}/index.docbook")
-      # When there is an index.docbook we mustn't copy the en_US version as
+      # When there is an index.docbook we mustn't copy the en version as
       # we have to write our own CMakeLists in order to have things installed
       # in the correct language directory! Also see kdoctools_create_handbook
       # arguments.
       write_handbook(dir, language, software_name)
     elsif !Dir.glob("#{dir}/*").select { |f| File.directory?(f) }.empty?
-      # -- Recyle en_US' CMakeLists --
-      enusdir = "#{dir}/../en_US/"
+      # -- Recyle en' CMakeLists --
+      enusdir = "#{dir}/../en/"
       enuscmake = "#{enusdir}/CMakeLists.txt"
       if File.exist?(enuscmake)
         # FIXME: naughty
-        FileUtils.cp(enuscmake, dir) unless File.basename(dir) == 'en_US'
+        FileUtils.cp(enuscmake, dir) unless File.basename(dir) == 'en'
         Dir.glob("#{dir}/**/**").each do |current_dir|
           next unless File.directory?(current_dir)
-          next if File.basename(dir) == 'en_US'
+          next if File.basename(dir) == 'en'
           dir_pathname = Pathname.new(dir)
           current_dir_pathname = Pathname.new(current_dir)
           relative_path = current_dir_pathname.relative_path_from(dir_pathname)
@@ -100,7 +100,7 @@ kdoctools_create_handbook(index.docbook
       fail 'There is no index.docbook but also no directories'
     end
 
-    # en_US may already have a super cmakelists, do not twiddle with it!
+    # en may already have a super cmakelists, do not twiddle with it!
     log_debug "Writing main cmakelists #{dir}/../CMakeLists.txt"
     # FIXME: not thread safe
     File.open("#{dir}/../CMakeLists.txt", 'a') do |f|
diff --git a/lib/documentation.rb b/lib/documentation.rb
index fdcae99..e9a565b 100644
--- a/lib/documentation.rb
+++ b/lib/documentation.rb
@@ -43,13 +43,13 @@ class DocumentationL10n < TranslationUnit
 
     log_info "Downloading documentations for #{srcdir}"
 
-    unless get_en_us('en_US')
-      log_warn 'There is no en_US documentation. Aborting :('
+    unless get_en('en')
+      log_warn 'There is no en documentation. Aborting :('
       return
     end
-    docs << 'en_US'
+    docs << 'en'
 
-    queue = languages_queue(%w(en_US))
+    queue = languages_queue(%w(en))
     threads = []
     THREAD_COUNT.times do
       threads << Thread.new do
@@ -84,19 +84,19 @@ class DocumentationL10n < TranslationUnit
     # FIXME: this could be put in the class instance assuming we never want to
     #        have different projects in the same ruby instance
     return @doc_dirs if defined? @doc_dirs
-    @doc_dirs = Dir.glob("#{@docdir}/en_US/*").collect do |f|
+    @doc_dirs = Dir.glob("#{@docdir}/en/*").collect do |f|
       next nil unless File.directory?(f)
       File.basename(f)
     end
     @doc_dirs = @doc_dirs.compact
   end
 
-  def get_en_us(language)
+  def get_en(language)
     # FIXME: code dup from regular get
     destdir = "#{@docdir}/#{language}"
 
     # On git a layout doc/{file,file,file} may appear, in this case we move
-    # stuff to en_US.
+    # stuff to en.
     # A more complicated case would be doc/{dir,dir}/{file,file} which can
     # happen for multisource repos such as plasma-workspace.
     unless Dir.glob("#{@docdir}/**/index.docbook").empty? ||
diff --git a/test/data/cmakeeditor/test_create_handbook_complex/en_US/CMakeLists.txt b/test/data/cmakeeditor/test_create_handbook_complex/en/CMakeLists.txt
similarity index 100%
rename from test/data/cmakeeditor/test_create_handbook_complex/en_US/CMakeLists.txt
rename to test/data/cmakeeditor/test_create_handbook_complex/en/CMakeLists.txt
diff --git a/test/data/cmakeeditor/test_create_handbook_complex/en_US/doc1/index.docbook b/test/data/cmakeeditor/test_create_handbook_complex/en/doc1/index.docbook
similarity index 100%
rename from test/data/cmakeeditor/test_create_handbook_complex/en_US/doc1/index.docbook
rename to test/data/cmakeeditor/test_create_handbook_complex/en/doc1/index.docbook
diff --git a/test/data/cmakeeditor/test_create_handbook_complex/en_US/doc2/index.docbook b/test/data/cmakeeditor/test_create_handbook_complex/en/doc2/index.docbook
similarity index 100%
rename from test/data/cmakeeditor/test_create_handbook_complex/en_US/doc2/index.docbook
rename to test/data/cmakeeditor/test_create_handbook_complex/en/doc2/index.docbook
diff --git a/test/data/cmakeeditor/test_create_handbook_complex/en_US/doc3/CMakeLists.txt b/test/data/cmakeeditor/test_create_handbook_complex/en/doc3/CMakeLists.txt
similarity index 100%
rename from test/data/cmakeeditor/test_create_handbook_complex/en_US/doc3/CMakeLists.txt
rename to test/data/cmakeeditor/test_create_handbook_complex/en/doc3/CMakeLists.txt
diff --git a/test/data/cmakeeditor/test_create_handbook_complex/en_US/doc3/doc3.1/index.docbook b/test/data/cmakeeditor/test_create_handbook_complex/en/doc3/doc3.1/index.docbook
similarity index 100%
rename from test/data/cmakeeditor/test_create_handbook_complex/en_US/doc3/doc3.1/index.docbook
rename to test/data/cmakeeditor/test_create_handbook_complex/en/doc3/doc3.1/index.docbook
diff --git a/test/test_cmakeeditor.rb b/test/test_cmakeeditor.rb
index c02cfeb..5012272 100644
--- a/test/test_cmakeeditor.rb
+++ b/test/test_cmakeeditor.rb
@@ -60,7 +60,7 @@ class TestCMakeEditor < Testme
   def test_create_handbook_complex
     origin_dir = "#{@datadir}/cmakeeditor/#{__method__}"
     FileUtils.cp_r(Dir.glob("#{origin_dir}/*"), '.')
-    %w(en_US de fr).each do |lang|
+    %w(en de fr).each do |lang|
       CMakeEditor.create_language_specific_doc_lists!("#{Dir.pwd}/#{lang}", lang, 'yolo')
     end
     # FIXME: put in testme as assert_files_exist
@@ -71,19 +71,19 @@ class TestCMakeEditor < Testme
       fr/doc2
       fr/doc2/CMakeLists.txt
       fr/doc2/index.docbook
-      en_US
-      en_US/CMakeLists.txt
-      en_US/doc1
-      en_US/doc1/CMakeLists.txt
-      en_US/doc1/index.docbook
-      en_US/doc2
-      en_US/doc2/CMakeLists.txt
-      en_US/doc2/index.docbook
-      en_US/doc3
-      en_US/doc3/CMakeLists.txt
-      en_US/doc3/doc3.1
-      en_US/doc3/doc3.1/CMakeLists.txt
-      en_US/doc3/doc3.1/index.docbook
+      en
+      en/CMakeLists.txt
+      en/doc1
+      en/doc1/CMakeLists.txt
+      en/doc1/index.docbook
+      en/doc2
+      en/doc2/CMakeLists.txt
+      en/doc2/index.docbook
+      en/doc3
+      en/doc3/CMakeLists.txt
+      en/doc3/doc3.1
+      en/doc3/doc3.1/CMakeLists.txt
+      en/doc3/doc3.1/index.docbook
       de
       de/CMakeLists.txt
       de/doc1
@@ -104,12 +104,12 @@ class TestCMakeEditor < Testme
     assert(missing_files.empty?, "missing file(S): #{missing_files}")
     assert(present_files.empty?, "unexpected file(s): #{present_files}")
     assert_equal_valid_meta_cmakelists('.')
-    assert_equal(File.read('en_US/CMakeLists.txt'),
+    assert_equal(File.read('en/CMakeLists.txt'),
                  File.read('fr/CMakeLists.txt'))
     assert_valid_kdoctools('fr/doc2/CMakeLists.txt')
-    assert_valid_kdoctools('en_US/doc1/CMakeLists.txt')
-    assert_valid_kdoctools('en_US/doc2/CMakeLists.txt')
-    assert_equal(File.read('en_US/CMakeLists.txt'),
+    assert_valid_kdoctools('en/doc1/CMakeLists.txt')
+    assert_valid_kdoctools('en/doc2/CMakeLists.txt')
+    assert_equal(File.read('en/CMakeLists.txt'),
                  File.read('de/CMakeLists.txt'))
     assert_valid_kdoctools('de/doc1/CMakeLists.txt')
   end
diff --git a/test/test_documentation.rb b/test/test_documentation.rb
index cd70a5f..21dead1 100644
--- a/test/test_documentation.rb
+++ b/test/test_documentation.rb
@@ -48,7 +48,7 @@ class TestDocumentation < Testme
   end
 
   def test_get_doc
-    # en_US & de
+    # en & de
     d = create_doc
     d.init_repo_url("file://#{Dir.pwd}/#{@svnTemplateDir}")
     FileUtils.rm_rf(@dir)
@@ -56,12 +56,12 @@ class TestDocumentation < Testme
     d.get(@dir)
     assert(File.exist?("#{@dir}/CMakeLists.txt"))
     assert(File.exist?("#{@dir}/doc/CMakeLists.txt"))
-    assert(File.exist?("#{@dir}/doc/en_US/index.docbook"))
-    assert(File.exist?("#{@dir}/doc/en_US/CMakeLists.txt"))
+    assert(File.exist?("#{@dir}/doc/en/index.docbook"))
+    assert(File.exist?("#{@dir}/doc/en/CMakeLists.txt"))
     assert(File.exist?("#{@dir}/doc/de/index.docbook"))
     assert(File.exist?("#{@dir}/doc/de/CMakeLists.txt"))
 
-    # en_US only (everything works if only doc/ is present in git but not
+    # en only (everything works if only doc/ is present in git but not
     # translated)
     d = create_doc_without_translation
     d.init_repo_url("file://#{Dir.pwd}/#{@svnTemplateDir}")
@@ -70,8 +70,8 @@ class TestDocumentation < Testme
     d.get(@dir)
     assert(File.exist?("#{@dir}/CMakeLists.txt"))
     assert(File.exist?("#{@dir}/doc/CMakeLists.txt"))
-    assert(File.exist?("#{@dir}/doc/en_US/index.docbook"))
-    assert(File.exist?("#{@dir}/doc/en_US/CMakeLists.txt"))
+    assert(File.exist?("#{@dir}/doc/en/index.docbook"))
+    assert(File.exist?("#{@dir}/doc/en/CMakeLists.txt"))
     assert(!File.exist?("#{@dir}/doc/de/index.docbook"))
     assert(!File.exist?("#{@dir}/doc/de/CMakeLists.txt"))
   end
@@ -89,21 +89,21 @@ class TestDocumentation < Testme
     # recursively through 2->2.1->2.1.1 at all.
     expected_files = %w(
       CMakeLists.txt
-      en_US
-      en_US/CMakeLists.txt
-      en_US/doc-valid2
-      en_US/doc-valid2/CMakeLists.txt
-      en_US/doc-valid2/index.docbook
-      en_US/doc-valid2/doc-valid2.1
-      en_US/doc-valid2/doc-valid2.1/CMakeLists.txt
-      en_US/doc-valid2/doc-valid2.1/index.docbook
-      en_US/doc-valid2/doc-valid2.1/doc-valid2.1.1
-      en_US/doc-valid2/doc-valid2.1/doc-valid2.1.1/CMakeLists.txt
-      en_US/doc-valid2/doc-valid2.1/doc-valid2.1.1/index.docbook
-      en_US/doc-invalid1
-      en_US/doc-valid1
-      en_US/doc-valid1/CMakeLists.txt
-      en_US/doc-valid1/index.docbook
+      en
+      en/CMakeLists.txt
+      en/doc-valid2
+      en/doc-valid2/CMakeLists.txt
+      en/doc-valid2/index.docbook
+      en/doc-valid2/doc-valid2.1
+      en/doc-valid2/doc-valid2.1/CMakeLists.txt
+      en/doc-valid2/doc-valid2.1/index.docbook
+      en/doc-valid2/doc-valid2.1/doc-valid2.1.1
+      en/doc-valid2/doc-valid2.1/doc-valid2.1.1/CMakeLists.txt
+      en/doc-valid2/doc-valid2.1/doc-valid2.1.1/index.docbook
+      en/doc-invalid1
+      en/doc-valid1
+      en/doc-valid1/CMakeLists.txt
+      en/doc-valid1/index.docbook
       de
       de/CMakeLists.txt
       de/doc-valid2



More information about the kde-doc-english mailing list