← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/appdata into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/appdata into lp:widelands.

Commit message:
Added added widelands.appdata.xml for debian desktops. Made this file and widelands.desktop localizable.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1271595 in widelands: "Please add a AppData application description"
  https://bugs.launchpad.net/widelands/+bug/1271595

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/appdata/+merge/294722

I don't really know how to test these files - have run the verification script though.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/appdata into lp:widelands.
=== modified file '.tx/config'
--- .tx/config	2016-03-24 06:28:37 +0000
+++ .tx/config	2016-05-15 07:19:50 +0000
@@ -138,3 +138,10 @@
 source_file = data/i18n/locales/locales_translators.json
 source_lang = en
 type = KEYVALUEJSON
+
+[widelands.appdata]
+file_filter = debian/translations/<lang>.json
+source_file = debian/translations/appdata.json
+source_lang = en
+type = KEYVALUEJSON
+

=== added directory 'debian/translations'
=== added file 'debian/translations/appdata.json'
--- debian/translations/appdata.json	1970-01-01 00:00:00 +0000
+++ debian/translations/appdata.json	2016-05-15 07:19:50 +0000
@@ -0,0 +1,8 @@
+{
+	"category": "Strategy Game",
+	"tagline": "A a real-time build-up strategy game",
+	"description":[
+		"You are the regent of a small clan. Your task is to build an ever growing settlement. Every member of your clan will do his or her part to produce more resources to further this growth.",
+		"Widelands offers a single-player mode with campaigns that tell stories of the tribes and their struggle in the Widelands universe. However, settling really starts when you unite with friends over the Internet or LAN to build up new empires together – or to crush each other in the dusts of war. Widelands also offers an artificial intelligence to challenge you."
+	]
+}

=== added file 'debian/translations/de.json'
--- debian/translations/de.json	1970-01-01 00:00:00 +0000
+++ debian/translations/de.json	2016-05-15 07:19:50 +0000
@@ -0,0 +1,8 @@
+{
+	"category": "Strategiespiel",
+	"tagline": "Echtzeitbasiertes Aufbau-Strategiespiel",
+	"description":[
+		"You are the regent of a small clan. Your task is to build an ever growing settlement. Every member of your clan will do his or her part to produce more resources to further this growth.",
+		"Widelands offers a single-player mode with campaigns that tell stories of the tribes and their struggle in the Widelands universe. However, settling really starts when you unite with friends over the Internet or LAN to build up new empires together – or to crush each other in the dusts of war. Widelands also offers an artificial intelligence to challenge you."
+	]
+}

=== added file 'debian/widelands.appdata.xml'
--- debian/widelands.appdata.xml	1970-01-01 00:00:00 +0000
+++ debian/widelands.appdata.xml	2016-05-15 07:19:50 +0000
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2016 The Widelands Development Team <widelands-dev_at_lists.launchpad.net> -->
+<component>
+  <id type="desktop">widelands.desktop</id>
+  <metadata_license>CC0-1.0</metadata_license>
+  <project_license>GPL-2.0</project_license>
+  <name>Widelands</name>
+  <summary>A a real-time build-up strategy game</summary>
+  <summary xml:lang="de">Echtzeitbasiertes Aufbau-Strategiespiel</summary>
+  <description>
+    <p>
+      You are the regent of a small clan. Your task is to build an ever growing settlement. Every member of your clan will do his or her part to produce more resources to further this growth.
+    </p>
+    <p>
+      Widelands offers a single-player mode with campaigns that tell stories of the tribes and their struggle in the Widelands universe. However, settling really starts when you unite with friends over the Internet or LAN to build up new empires together – or to crush each other in the dusts of war. Widelands also offers an artificial intelligence to challenge you.
+    </p>
+  </description>
+  <screenshots>
+    <screenshot type="default">
+      <image>https://wl.widelands.org/wlmedia/wlscreens/screens/Current%20Developments/To%20the%20sea.png</image>
+      <caption>Fleet of Ships</caption>
+    </screenshot>
+    <screenshot>
+      <image>https://wl.widelands.org/wlmedia/wlscreens/screens/Build%2018%20(until%20now)/Seafaring%20Expedition.png</image>
+      <caption>Seafaring Expedition</caption>
+    </screenshot>
+    <screenshot>
+      <image>https://wl.widelands.org/wlmedia/wlscreens/screens/Build%2017/Playing%20online.png</image>
+      <caption>Multiplayer Game Setup</caption>
+    </screenshot>
+  </screenshots>
+  <url type="homepage">https://wl.widelands.org/</url>
+  <update_contact>widelands-dev_at_lists.launchpad.net</update_contact>
+  <releases>
+    <release date="2014-02-22" version="Build 18"/>
+    <release date="2012-04-23" version="Build 17"/>
+    <release date="2011-04-15" version="Build 16"/>
+    <release date="2010-04-16" version="Build 15"/>
+    <release date="2009-12-11" version="Build 14"/>
+    <release date="2008-12-01" version="Build 13"/>
+    <release date="2008-04-06" version="Build 12"/>
+    <release date="2007-09-12" version="Build 11"/>
+    <release date="2007-03-20" version="Build 10"/>
+    <release date="2005-12-05" version="Build 9half"/>
+    <release date="2005-01-10" version="Build 9"/>
+    <release date="2004-09-18" version="Build 8"/>
+    <release date="2004-08-06" version="Build 7"/>
+    <release date="2003-10-18" version="Build 6"/>
+    <release date="2003-09-05" version="Build 5"/>
+    <release date="2003-01-09" version="Build 4"/>
+    <release date="2002-09-07" version="Build 3"/>
+    <release date="2002-09-03" version="Build 2"/>
+    <release date="2002-08-27" version="Build 1"/>
+  </releases>
+  <url type="bugtracker">https://bugs.launchpad.net/widelands</url>
+  <url type="donation">https://wl.widelands.org/wiki/The%20Widelands%20Project/</url>
+  <url type="help">https://wl.widelands.org/wiki/Game%20Manual/</url>
+  <developer_name>The Widelands Development Team</developer_name>
+</component>

=== added file 'debian/widelands.appdata.xml.stub'
--- debian/widelands.appdata.xml.stub	1970-01-01 00:00:00 +0000
+++ debian/widelands.appdata.xml.stub	2016-05-15 07:19:50 +0000
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2016 The Widelands Development Team <widelands-dev_at_lists.launchpad.net> -->
+<component>
+  <id type="desktop">widelands.desktop</id>
+  <metadata_license>CC0-1.0</metadata_license>
+  <project_license>GPL-2.0</project_license>
+  <name>Widelands</name>
+  SUMMARY_DESCRIPTION_HOOK
+  <screenshots>
+    <screenshot type="default">
+      <image>https://wl.widelands.org/wlmedia/wlscreens/screens/Current%20Developments/To%20the%20sea.png</image>
+      <caption>Fleet of Ships</caption>
+    </screenshot>
+    <screenshot>
+      <image>https://wl.widelands.org/wlmedia/wlscreens/screens/Build%2018%20(until%20now)/Seafaring%20Expedition.png</image>
+      <caption>Seafaring Expedition</caption>
+    </screenshot>
+    <screenshot>
+      <image>https://wl.widelands.org/wlmedia/wlscreens/screens/Build%2017/Playing%20online.png</image>
+      <caption>Multiplayer Game Setup</caption>
+    </screenshot>
+  </screenshots>
+  <url type="homepage">https://wl.widelands.org/</url>
+  <update_contact>widelands-dev_at_lists.launchpad.net</update_contact>
+  <releases>
+    <release date="2014-02-22" version="Build 18"/>
+    <release date="2012-04-23" version="Build 17"/>
+    <release date="2011-04-15" version="Build 16"/>
+    <release date="2010-04-16" version="Build 15"/>
+    <release date="2009-12-11" version="Build 14"/>
+    <release date="2008-12-01" version="Build 13"/>
+    <release date="2008-04-06" version="Build 12"/>
+    <release date="2007-09-12" version="Build 11"/>
+    <release date="2007-03-20" version="Build 10"/>
+    <release date="2005-12-05" version="Build 9half"/>
+    <release date="2005-01-10" version="Build 9"/>
+    <release date="2004-09-18" version="Build 8"/>
+    <release date="2004-08-06" version="Build 7"/>
+    <release date="2003-10-18" version="Build 6"/>
+    <release date="2003-09-05" version="Build 5"/>
+    <release date="2003-01-09" version="Build 4"/>
+    <release date="2002-09-07" version="Build 3"/>
+    <release date="2002-09-03" version="Build 2"/>
+    <release date="2002-08-27" version="Build 1"/>
+  </releases>
+  <url type="bugtracker">https://bugs.launchpad.net/widelands</url>
+  <url type="donation">https://wl.widelands.org/wiki/The%20Widelands%20Project/</url>
+  <url type="help">https://wl.widelands.org/wiki/Game%20Manual/</url>
+  <developer_name>The Widelands Development Team</developer_name>
+</component>

=== added file 'debian/widelands.desktop.stub'
--- debian/widelands.desktop.stub	1970-01-01 00:00:00 +0000
+++ debian/widelands.desktop.stub	2016-05-15 07:19:50 +0000
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Type=Application
+Name=Widelands
+GENERIC_NAME_COMMENT_HOOK
+Icon=/usr/share/games/widelands/data/images/logos/wl-ico-64.png
+TryExec=widelands
+Exec=widelands
+Categories=Application;Game;StrategyGame;

=== modified file 'debian/widelands.install'
--- debian/widelands.install	2016-01-22 07:20:01 +0000
+++ debian/widelands.install	2016-05-15 07:19:50 +0000
@@ -1,5 +1,7 @@
 usr/widelands usr/games
 usr/wl_map_info usr/games
 usr/wl_render_richtext usr/games
+widelands.appdata.xml /usr/share/appdata
+widelands.desktop usr/share/applications
 usr/share/applications
 usr/share/icons

=== modified file 'utils/merge_and_push_translations.sh'
--- utils/merge_and_push_translations.sh	2016-01-28 06:21:47 +0000
+++ utils/merge_and_push_translations.sh	2016-05-15 07:19:50 +0000
@@ -47,6 +47,16 @@
   exit 1;
 fi
 
+# Update appdata
+utils/update_appdata.py
+if [ $? -eq 0 ]
+then
+  echo "Updated appdata";
+else
+  echo "Failed updating appdata";
+  exit 1;
+fi
+
 # Fix line breaks.
 # TODO(GunChleoc): We hope that Transifex will fix these already.
 # This script can be removed if we don't get any errors in the future.

=== added file 'utils/update_appdata.py'
--- utils/update_appdata.py	1970-01-01 00:00:00 +0000
+++ utils/update_appdata.py	2016-05-15 07:19:50 +0000
@@ -0,0 +1,128 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+import codecs
+import json
+import os.path
+import sys
+
+# This script collects translations for the appdata.xml
+# All non-translatable content is taken from ../debian/widelands.appdata.xml.stub
+# That file contains a SUMMARY_DESCRIPTION_HOOK where the translatable information
+# is inserted.
+#
+# The translations are sourced from ../debian/translations/
+#
+# The output is written to ../debian/widelands.appdata.xml
+
+print("Updating appdata.xml and .desktop files")
+print("- Checking files")
+
+base_path = os.path.abspath(os.path.join(os.path.dirname(__file__),os.path.pardir))
+
+appdata_input_filename = os.path.normpath(base_path + "/debian/widelands.appdata.xml.stub")
+if (not os.path.isfile(appdata_input_filename)):
+	print("Error: File " + appdata_input_filename + " not found.")
+	sys.exit(1)
+
+desktop_input_filename = os.path.normpath(base_path + "/debian/widelands.desktop.stub")
+if (not os.path.isfile(desktop_input_filename)):
+	print("Error: File " + desktop_input_filename + " not found.")
+	sys.exit(1)
+
+translations_path = os.path.normpath(base_path + "/debian/translations")
+if (not os.path.isdir(translations_path)):
+	print("Error: Path " + translations_path + " not found.")
+	sys.exit(1)
+
+english_source_filename =  os.path.normpath(base_path + "/debian/translations/appdata.json")
+if (not os.path.isfile(english_source_filename)):
+	print("Error: File " + english_source_filename + " not found.")
+	sys.exit(1)
+
+print("- Reading source from JSON:")
+
+english_source_file = open(english_source_filename, "r")
+english_source = json.load(english_source_file)
+
+tagline_en = english_source["tagline"]
+descriptions_en = english_source["description"]
+generic_name_en = english_source["category"]
+
+english_source_file.close()
+
+# For appdata.xml
+summaries = "  <summary>" + tagline_en + "</summary>\n"
+descriptions = "  <description>\n"
+for description in descriptions_en:
+	descriptions += "    <p>\n"
+	descriptions += "      " + description + "\n"
+	descriptions += "    </p>\n"
+descriptions += "  </description>\n"
+
+# For .desktop
+generic_names = "GenericName=" + generic_name_en + "\n"
+comments = "Comment=" + tagline_en + "\n"
+
+print("- Reading translations from JSON:")
+
+# Each language's translations live in a separate file, so we list the dir
+translation_files = sorted(os.listdir(translations_path), key=str.lower)
+
+for translation_filename in translation_files:
+	# Only json files, and not the template file please
+	if translation_filename.endswith(".json") and translation_filename != "appdata.json":
+		translation_file = open(translations_path + "/" + translation_filename, "r")
+		translation = json.load(translation_file)
+		lang_code = translation_filename[:-5]
+		tagline = translation["tagline"]
+		if tagline != tagline_en:
+			summaries += "  <summary xml:lang=\"" + lang_code + "\">"+ tagline +"</summary>\n" # appdata.xml
+			comments += "Comment[" + lang_code + "]="+ tagline +"\n" # .desktop
+		generic_name = translation["category"]
+		if generic_name != generic_name_en:
+			generic_names += "GenericName[" + lang_code + "]="+ generic_name +"\n" # .desktop
+		if translation["description"] != descriptions_en:
+			descriptions += "  <description xml:lang=\"" + lang_code + "\">\n" # appdata.xml
+			for description in translation["description"]:
+				descriptions += "    <p>\n"
+				descriptions += "      " + description + "\n"
+				descriptions += "    </p>\n"
+			descriptions += "  </description>\n"
+		translation_file.close()
+
+print("- Writing widelands.appdata.xml")
+input_file = open(appdata_input_filename, "r")
+appdata = ""
+
+for line in input_file:
+	if line.strip() != "SUMMARY_DESCRIPTION_HOOK":
+		appdata += line
+	else:
+		appdata += summaries + descriptions
+
+input_file.close()
+
+dest_filepath = base_path + "/debian/widelands.appdata.xml"
+dest_file = codecs.open(dest_filepath, encoding='utf-8', mode='w')
+dest_file.write(appdata)
+dest_file.close()
+
+print("- Writing .desktop")
+input_file = open(desktop_input_filename, "r")
+desktop = ""
+
+for line in input_file:
+	if line.strip() != "GENERIC_NAME_COMMENT_HOOK":
+		desktop += line
+	else:
+		desktop += generic_names + comments
+
+input_file.close()
+
+dest_filepath = base_path + "/debian/widelands.desktop"
+dest_file = codecs.open(dest_filepath, encoding='utf-8', mode='w')
+dest_file.write(desktop)
+dest_file.close()
+
+print("Done!")


Follow ups