← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/localization-post-build20 into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/localization-post-build20 into lp:widelands.

Commit message:
Backlog of localization updates

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/localization-post-build20/+merge/367305
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/localization-post-build20 into lp:widelands.
=== modified file 'data/campaigns/fri01.wmf/scripting/texts.lua'
--- data/campaigns/fri01.wmf/scripting/texts.lua	2018-09-29 08:43:57 +0000
+++ data/campaigns/fri01.wmf/scripting/texts.lua	2019-05-11 12:00:32 +0000
@@ -129,8 +129,8 @@
       -- TRANSLATORS: Reebaud – Introduction 1
       _([[Welcome to the beautiful isle of Langeness! I am Reebaud, the chieftain of this pristine island.]])
       .. paragraphdivider() ..
-      -- TRANSLATORS: Reebaud – Introduction 1
-      _([[My tribe and I have just arrived from the mainland. There were fights with the Danes in the North, the Vikings in the East… So, I decided to lead my tribe away to start a quiet, peaceful life on this untouched island.]])),
+      -- TRANSLATORS: Reebaud – Introduction 1. Schauenburg and Holstein are dukedoms
+      _([[My tribe and I have just arrived from the mainland. There were fights with the Danes in the North, the Schauenburgers and Holsteiners in the East and South… So I decided to lead my tribe away to start a quiet, peaceful life on this untouched island.]])),
 }
 intro_2 = {
    title =_ "Introduction",
@@ -139,13 +139,13 @@
       _([[This is as good a place as any to start building our new home. First of all, we must ensure a stable supply of basic building materials.]])
       .. paragraphdivider() ..
       -- TRANSLATORS: Reebaud – Introduction 2
-      _([[I have asked Hauke, one of my advisors to oversee the construction of our settlement.]])),
+      _([[I have asked Hauke, one of my advisors, to oversee the construction of our settlement.]])),
 }
 intro_3 = {
    title =_ "Introduction",
    body=hauke(_"The first buildings",
-      -- TRANSLATORS: Hauke – Introduction 3
-      _([[Greetings, Chieftain Reebaud! I will start with the colonization of the island straight away.]])
+      -- TRANSLATORS: Hauke – Introduction 3. "Peace" is the traditional frisian greeting
+      _([[Peace, Chieftain Reebaud! I will start with the colonization of the island straight away.]])
       .. paragraphdivider() ..
       -- TRANSLATORS: Hauke – Introduction 3
       _([[Like all Frisians, we build our houses mainly with bricks. We improve them by adding some logs and granite. The roofs are thatched with reed, naturally. Nothing is better suited to keep the rain out.]])

=== modified file 'data/campaigns/fri02.wmf/scripting/texts.lua'
--- data/campaigns/fri02.wmf/scripting/texts.lua	2018-09-29 08:43:57 +0000
+++ data/campaigns/fri02.wmf/scripting/texts.lua	2019-05-11 12:00:32 +0000
@@ -274,8 +274,8 @@
 supply_murilius_4 = {
    title =_ "We Are Not Alone",
    body=reebaud(_"Strangers",
-      -- TRANSLATORS: Reebaud – Supply Murilius 4
-      _([[Greetings, representative of the Empire! I am Reebaud, the chieftain of this tribe. All we want is to settle down here, build our home and live our lives in peace. We do not seek trouble, but we aren’t afraid to fight, either.]])),
+      -- TRANSLATORS: Reebaud – Supply Murilius 4. "Peace" is the traditional frisian greeting, nothing more.
+      _([[Peace, representative of the Empire! I am Reebaud, the chieftain of this tribe. All we want is to settle down here, build our home and live our lives in peace. We do not seek trouble, but we aren’t afraid to fight, either.]])),
 }
 supply_murilius_5 = {
    title =_ "We Are Not Alone",

=== modified file 'data/tribes/scripting/help/worker_help.lua'
--- data/tribes/scripting/help/worker_help.lua	2018-09-29 05:10:39 +0000
+++ data/tribes/scripting/help/worker_help.lua	2019-05-11 12:00:32 +0000
@@ -101,9 +101,16 @@
    if (#worker_description.employers > 0) then
       local normal = {}
       local additional = {}
-      -- TRANSLATORS: Worker Encyclopedia: A list of buildings where a worker is needed to work at
-      -- TRANSLATORS: You can also translate this as 'workplace(s)'
-      result = result .. h2(ngettext("Works at", "Works at", #worker_description.employers))
+
+      if #worker_description.employers == 1 then
+         -- TRANSLATORS: Worker Encyclopedia: A list with 1 building where a worker is needed to work at
+         -- TRANSLATORS: You can also translate this as 'workplace'
+         result = result .. h2(pgettext("workerhelp_one_building", "Works at"))
+      else
+         -- TRANSLATORS: Worker Encyclopedia: A list of buildings where a worker is needed to work at
+         -- TRANSLATORS: You can also translate this as 'workplace(s)'
+         result = result .. h2(ngettext("Works at", "Works at", #worker_description.employers))
+      end
       for i, building in ipairs(worker_description.employers) do
          result = result .. dependencies({worker_description, building}, building.descname)
          normal[building.descname] = true
@@ -115,17 +122,15 @@
                   table.insert(additional, build)
                end
             end
-            --[[ TODO(GunChleoc): Put this in after Build 20, activate the translators comments and also fix the plural above
             if #additional == 1 then
-               -- #Translators: Worker Encyclopedia: Heading above a list of buildings where a worker may work instead of a less experienced worker
-               -- #TRANSLATORS: You can also translate this as 'additional workplace'
+               -- Translators: Worker Encyclopedia: Heading above a list 1 building where a worker may work instead of a less experienced worker
+               -- TRANSLATORS: You can also translate this as 'additional workplace'
                result = result .. h3(pgettext("workerhelp_one_building", "Can also work at"))
             else
-               -- #Translators: Worker Encyclopedia: Heading above a list of buildings where a worker may work instead of a less experienced worker
-                  -- #TRANSLATORS: You can also translate this as 'additional workplaces'
+               -- Translators: Worker Encyclopedia: Heading above a list of buildings where a worker may work instead of a less experienced worker
+               -- TRANSLATORS: You can also translate this as 'additional workplace(s)'
                result = result .. h3(ngettext("Can also work at", "Can also work at", #additional))
             end
-            ]]
             for i, build in ipairs(additional) do
                result = result .. dependencies({worker_description, build}, build.descname)
             end

=== modified file 'src/graphic/CMakeLists.txt'
--- src/graphic/CMakeLists.txt	2019-05-04 15:37:33 +0000
+++ src/graphic/CMakeLists.txt	2019-05-11 12:00:32 +0000
@@ -104,8 +104,10 @@
   DEPENDS
     base_exceptions
     base_geometry
+    base_i18n
     base_log
     base_macros
+    graphic_text
     io_fileread
     io_filesystem
 )

=== modified file 'src/graphic/gl/initialize.cc'
--- src/graphic/gl/initialize.cc	2019-04-09 16:43:49 +0000
+++ src/graphic/gl/initialize.cc	2019-05-11 12:00:32 +0000
@@ -24,10 +24,13 @@
 
 #include <SDL.h>
 #include <boost/algorithm/string.hpp>
+#include <boost/format.hpp>
 #include <boost/regex.hpp>
 
+#include "base/i18n.h"
 #include "base/macros.h"
 #include "graphic/gl/utils.h"
+#include "graphic/text/bidi.h"
 
 namespace Gl {
 
@@ -184,6 +187,21 @@
 	   reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION));
 	log("Graphics: OpenGL: ShadingLanguage: \"%s\"\n", shading_language_version_string);
 
+	// Show a basic SDL window with an error message, and log it too, then exit 1. Since font support does not exist for all languages, we show both the original and a localized text.
+	auto show_opengl_error_and_exit = [] (const std::string& message, const std::string& localized_message) {
+		std::string display_message = "";
+		if (message != localized_message) {
+			display_message = message + "\n\n" + (i18n::has_rtl_character(localized_message.c_str()) ? i18n::line2bidi(i18n::make_ligatures(localized_message.c_str()).c_str()) : localized_message);
+		} else {
+			display_message = message;
+		}
+
+		/** TRANSLATORS: Error message printed to console/command line/log file */
+		log(_("ERROR: %s\n"), display_message.c_str());
+		SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "OpenGL Error", display_message.c_str(), NULL);
+		exit(1);
+	};
+
 	std::vector<std::string> shading_language_version_vector;
 	boost::split(
 	   shading_language_version_vector, shading_language_version_string, boost::is_any_of("."));
@@ -196,12 +214,14 @@
 		   atoi(shading_language_version_vector.at(1).c_str());
 		if (major_shading_language_version < 1 ||
 		    (major_shading_language_version == 1 && minor_shading_language_version < 20)) {
-			log("ERROR: Shading language version is too old!\n");
-			SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "OpenGL Error",
-			                         "Widelands won’t work because your graphics driver is too old.\n"
-			                         "The shading language needs to be version 1.20 or newer.",
-			                         nullptr);
-			exit(1);
+			show_opengl_error_and_exit("Widelands won’t work because your graphics driver is too old.\n"
+									   "The shading language needs to be version 1.20 or newer.",
+									   (boost::format("%s\n%s") %
+									   /** TRANSLATORS: Basic error message when we can't handle the graphics driver. Font support is limited here, so do not use advanced typography **/
+									   _("Widelands won’t work because your graphics driver is too old.") %
+										/** TRANSLATORS: Basic error message when we can't handle the graphics driver. Font support is limited here, so do not use advanced typography **/
+										_("The shading language needs to be version 1.20 or newer.")).str());
+
 		}
 	} else {
 		// We don't have a minor version. Ensure that the string to compare is a valid integer before
@@ -210,25 +230,26 @@
 		if (boost::regex_match(shading_language_version_string, re)) {
 			const int major_shading_language_version = atoi(shading_language_version_string);
 			if (major_shading_language_version < 2) {
-				log("ERROR: Shading language version is too old!\n");
-				SDL_ShowSimpleMessageBox(
-				   SDL_MESSAGEBOX_ERROR, "OpenGL Error",
-				   "Widelands won’t work because your graphics driver is too old.\n"
-				   "The shading language needs to be version 1.20 or newer.",
-				   nullptr);
-				exit(1);
+				show_opengl_error_and_exit("Widelands won’t work because your graphics driver is too old.\n"
+										   "The shading language needs to be version 1.20 or newer.",
+										   (boost::format("%s\n%s") %
+										   /** TRANSLATORS: Basic error message when we can't handle the graphics driver. Font support is limited here, so do not use advanced typography **/
+										   _("Widelands won’t work because your graphics driver is too old.") %
+											/** TRANSLATORS: Basic error message when we can't handle the graphics driver. Font support is limited here, so do not use advanced typography **/
+											_("The shading language needs to be version 1.20 or newer.")).str());
+
 			}
 		} else {
 			// Exit because we couldn't detect the shading language version, so there must be a problem
 			// communicating with the graphics adapter.
-			log("ERROR: Unable to detect the shading language version!\n");
-			SDL_ShowSimpleMessageBox(
-			   SDL_MESSAGEBOX_ERROR, "OpenGL Error",
-			   "Widelands won't work because we were unable to detect the shading "
-			   "language version.\nThere is an unknown problem with reading the "
-			   "information from the graphics driver.",
-			   nullptr);
-			exit(1);
+			show_opengl_error_and_exit("Widelands won't work because we were unable to detect the shading language version.\n"
+									   "There is an unknown problem with reading the information from the graphics driver.",
+									   (boost::format("%s\n%s") %
+										/** TRANSLATORS: Basic error message when we can't handle the graphics driver. Font support is limited here, so do not use advanced typography **/
+										_("Widelands won't work because we were unable to detect the shading language version.") %
+										/** TRANSLATORS: Basic error message when we can't handle the graphics driver. Font support is limited here, so do not use advanced typography **/
+										 _("There is an unknown problem with reading the information from the graphics driver.")).str());
+
 		}
 	}
 


Follow ups