diff options
author | mdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-08-24 20:07:02 +0000 |
---|---|---|
committer | mdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-08-24 20:07:02 +0000 |
commit | cc979a2a88e803f649a61645999944fe328fd352 (patch) | |
tree | ced811dc918d44fc28d15e796607dc491c12b962 /navit/android | |
parent | eb3b97ad63abcc1be8c8dfd9b5f98e7e2eeb3cdf (diff) | |
download | navit-cc979a2a88e803f649a61645999944fe328fd352.tar.gz |
Add:port_android:Build localized Android string resources from gettext db.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5599 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/android')
-rw-r--r-- | navit/android/CMakeLists.txt | 21 | ||||
-rw-r--r-- | navit/android/po2xml.xslt | 40 | ||||
-rw-r--r-- | navit/android/res/values-de/strings.xml | 76 | ||||
-rw-r--r-- | navit/android/res/values-fr/strings.xml | 57 | ||||
-rw-r--r-- | navit/android/res/values-nl/strings.xml | 57 | ||||
-rw-r--r-- | navit/android/res/values/strings-dont-translate.xml | 22 | ||||
-rw-r--r-- | navit/android/res/values/strings.xml | 14 |
7 files changed, 84 insertions, 203 deletions
diff --git a/navit/android/CMakeLists.txt b/navit/android/CMakeLists.txt index 0e3f32a7f..a23c5be2b 100644 --- a/navit/android/CMakeLists.txt +++ b/navit/android/CMakeLists.txt @@ -6,6 +6,25 @@ if (ANDROID) set(ANDROID_PERMISSIONS_EXPANDED "${ANDROID_PERMISSIONS_EXPANDED}<uses-permission\tandroid:name=\\\"android.permission.${PERMISSION}\\\"/>" ) endforeach() + # Generate Android string resource files from gettext .po.in files. + # Note: Android language resources should have two letter ISO 639-1 code, and, optionally, iso-3166-1-alpha-2 region code, + # so we skip all translation files which do not conform these requirements. + FILE(GLOB POIN_FILES1 RELATIVE ${CMAKE_SOURCE_DIR}/po "${CMAKE_SOURCE_DIR}/po/??.po.in") + FILE(GLOB POIN_FILES2 RELATIVE ${CMAKE_SOURCE_DIR}/po "${CMAKE_SOURCE_DIR}/po/??_??.po.in") + set(POIN_FILES ${POIN_FILES1} ${POIN_FILES2}) + foreach (POIN_FILE ${POIN_FILES}) + string(REPLACE ".po.in" "" LANG ${POIN_FILE}) + string(REPLACE "_" "-r" LANG ${LANG}) + set(LANG_RESOURCES ${LANG_RESOURCES} "${CMAKE_CURRENT_BINARY_DIR}/res/values-${LANG}/strings.xml") + compose_xslt_transform_command(TRANS "${CMAKE_CURRENT_SOURCE_DIR}/po2xml.xslt" "${CMAKE_CURRENT_SOURCE_DIR}/res/values/strings.xml" "${CMAKE_CURRENT_BINARY_DIR}/res/values-${LANG}/strings.xml" "po_file=${CMAKE_SOURCE_DIR}/po/${POIN_FILE}") + ADD_CUSTOM_COMMAND( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/res/values-${LANG}/strings.xml" + DEPENDS "${CMAKE_BINARY_DIR}/po/navit.pot" "${CMAKE_SOURCE_DIR}/po/${POIN_FILE}" "${CMAKE_CURRENT_SOURCE_DIR}/po2xml.xslt" "${CMAKE_CURRENT_SOURCE_DIR}/res/values/strings.xml" + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/res/values-${LANG} + ${TRANS} + ) + endforeach(POIN_FILE ${POIN_FILES}) + add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/AndroidManifest.xml DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake @@ -28,7 +47,7 @@ if (ANDROID) ) add_custom_target( android_resources - DEPENDS build.xml ${MODULES_NAME} ${NAVIT_SUPPORT_LIBS} + DEPENDS build.xml ${MODULES_NAME} ${NAVIT_SUPPORT_LIBS} ${LANG_RESOURCES} COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/res/raw/ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/libs/${ANDROID_ARCH} COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/navit/libnavit.so ${CMAKE_CURRENT_BINARY_DIR}/libs/${ANDROID_ARCH}/ diff --git a/navit/android/po2xml.xslt b/navit/android/po2xml.xslt new file mode 100644 index 000000000..1a92d2db4 --- /dev/null +++ b/navit/android/po2xml.xslt @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:po2xml="http://example.com/namespace" exclude-result-prefixes="po2xml"> +<xsl:param name="po_file"/> +<xsl:output method="xml" indent="yes" encoding="utf-8"/> + +<xsl:function name="po2xml:escape"> + <xsl:param name="str" /> + <xsl:sequence select="replace($str,concat('(',codepoints-to-string(39),')'),'\\$1')" /> +</xsl:function> + +<xsl:template match="/"> + <resources> + <xsl:variable name="r" select="." /> + <xsl:for-each select="tokenize(replace(unparsed-text($po_file),'\r',''), '\n+\n')"> + <xsl:analyze-string regex="(.*\n)?msgid "(.*)"\nmsgstr "(.*)"$" select="." flags="s"> + <xsl:matching-substring> + <xsl:variable name="comment" select="replace(regex-group(1),'#','')" /> + <xsl:variable name="msgid" select="po2xml:escape(replace(regex-group(2),'"\n"','','s'))" /> + <xsl:variable name="msgstr" select="po2xml:escape(replace(regex-group(3),'"\n"','','s'))" /> + <xsl:variable name="resname" select="$r/resources/string[text()=$msgid]/@name" /> + <xsl:choose> + <xsl:when test="$msgid!='' and $msgstr!='' and $resname!=''"> + <xsl:choose> + <xsl:when test="$comment!=''"> + <xsl:comment select="$comment"/> + </xsl:when> + </xsl:choose> + <string> + <xsl:attribute name='name'><xsl:value-of select="$resname"/></xsl:attribute> + <xsl:value-of select="$msgstr"/> + </string> + </xsl:when> + </xsl:choose> + </xsl:matching-substring> + </xsl:analyze-string> + </xsl:for-each> + </resources> +</xsl:template> +</xsl:transform> + diff --git a/navit/android/res/values-de/strings.xml b/navit/android/res/values-de/strings.xml deleted file mode 100644 index 317b94fda..000000000 --- a/navit/android/res/values-de/strings.xml +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <!-- LANG=de --> - <!-- GENERIC --> - <!-- All generic strings fallback to default (en) --> - - <!-- NOTIFICATION --> - <string name="notification_name">@string/app_name</string> - <string name="notification_ticker">Navit gestartet</string> - <string name="notification_event_default">Navit läuft</string> - <string name="yes">Ja</string> - <string name="no">Nein</string> - - <!-- INITIAL INFOBOX --> - <string name="initial_info_box_title">Willkommen bei Navit</string> - <string name="initial_info_box_message">Vielen Dank für die Installation von Navit!\n\nBitte zuerst im Menu \"Karten herunterladen\" auswählen und eine Karte für die gewünschte Region herunterladen. Die Kartendatei ist sehr groß, bitte Flatrate oder ähnliches aktivieren!\n\nKartendaten: CC-BY-SA OpenStreetMap Project\n\nViel Spaß mit Navit!</string> - <string name="initial_info_box_OK">OK</string> - <string name="initial_info_box_more_info">Mehr Infos</string> - - <!-- OPTIONS MENU --> - <string name="optionsmenu_zoom_in"> Vergrößern</string> - <string name="optionsmenu_zoom_out">Verkleinern</string> - <string name="optionsmenu_download_maps">Karten herunterladen</string> - <string name="optionsmenu_toggle_poi">POI ein/aus</string> - <string name="optionsmenu_address_search">@string/address_search_title</string> - <string name="optionsmenu_exit_navit">Navit beenden</string> - <string name="optionsmenu_backup_restore">Sichern / Wiederherstellen</string> - - <!-- POSITION POP-UP --> - <string name="position_popup_title">Position</string> - <string name="position_popup_drive_here">Ziel setzen</string> - - <!-- MAP DOWNLOAD --> - <string name="map_delete">Diese Karte löschen?</string> - <string name="map_download_title">Kartendownload</string> - <string name="map_download_downloading">Laden:</string> - <string name="map_download_eta">Fertig in</string> - <string name="map_download_ready">bereit</string> - <string name="map_download_download_error">Fehler beim Kartendownload</string> - <string name="map_download_download_aborted">Download der Karte abgebrochen</string> - <string name="map_download_not_enough_free_space">Nicht genug freier Speicher</string> - <string name="map_no_fix">Position noch nicht bekannt.</string> - <string name="maps_for_current_location">Karten passend zur aktuellen Position</string> - - <!-- ADDRESS SEARCH --> - <string name="address_search_title">Adresse suchen</string> - <string name="address_enter_destination">Ziel eingeben</string> - <string name="address_partial_match">Ungefähr</string> - <string name="address_search_button">Suche</string> - <string name="address_search_searching">Suche läuft#8230;</string> - <string name="address_search_not_found">Keine Adresse gefunden</string> - <string name="address_search_getting_results">Abrufen von Suchergebnissen</string> - <string name="address_search_loading_results">Lädt Suchergebnisse</string> - <string name="address_search_no_results">Suche liefert kein Ergebnis!</string> - <string name="address_search_no_text_entered">Keine Eingabe</string> - <string name="address_search_set_destination">Neues Fahrziel:</string> - <string name="address_search_towns">Städte</string> - <string name="address_search_streets">Straßen</string> - - <!-- Backup Restore --> - <string name="choose_an_action">Bitte auswählen</string> - <string name="please_insert_an_sd_card">Bitte eine SD Karte einlegen</string> - <string name="backing_up">Sichern...</string> - <string name="failed_to_create_backup_directory">Sicherungsverzeichnis konnte nicht erstellt werden</string> - <string name="backup_failed">Sicherung Fehlgeschlagen</string> - <string name="no_backup_found">Keine Sicherung gefunden</string> - <string name="failed_to_restore">Fehler beim Wiederherstellen</string> - <string name="backup_successful">Sicherung erfolgreich</string> - <string name="restore_successful_please_restart_navit">Sicherung Erfolgreich\nNavit bitte neustarten</string> - <string name="backup_not_found">Backup nicht gefunden</string> - <string name="restore_failed">Wiederherstellen fehlgeschlagen</string> - <string name="select_backup">Backup auswählen</string> - <string name="backup">Sichern</string> - <string name="restore">Wiederherstellen</string> -</resources> - diff --git a/navit/android/res/values-fr/strings.xml b/navit/android/res/values-fr/strings.xml deleted file mode 100644 index 8872ae87b..000000000 --- a/navit/android/res/values-fr/strings.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <!-- LANG=fr --> - <!-- GENERIC --> - <!-- All generic strings fallback to default (en) --> - - <!-- NOTIFICATION --> - <string name="notification_name">@string/app_name</string> - <string name="notification_ticker">Navit commencé</string> - <string name="notification_event_default">Navit exécute</string> - <string name="yes">Oui</string> - <string name="no">Non</string> - - <!-- INITIAL INFOBOX --> - <string name="initial_info_box_title">Bienvenue chez Navit</string> - <string name="initial_info_box_message">Nous vous remercions d\'avoir installé Navit!\n\nPour commencer, sélectionnez \"Télécharger des cartes\" du menu et télechargez une carte de votre région. Les cartes sont volumineuses, donc il est préférable d\'avoir une connection internet illimitée!\n\nCartes: CC-BY-SA OpenStreetMap Project\n\nAmusez-vous avec Navit!</string> - <string name="initial_info_box_OK">OK</string> - <string name="initial_info_box_more_info">Plus d\'infos</string> - - <!-- OPTIONS MENU --> - <string name="optionsmenu_zoom_in">Zoom-avant</string> - <string name="optionsmenu_zoom_out">Zoom-arrière</string> - <string name="optionsmenu_download_maps">Télécharger des cartes</string> - <string name="optionsmenu_toggle_poi">POI on/off</string> - <string name="optionsmenu_address_search">@string/address_search_title</string> - <string name="optionsmenu_exit_navit">Quitter Navit</string> - - <!-- POSITION POP-UP --> - <string name="position_popup_title">Position</string> - <string name="position_popup_drive_here">Conduire ici</string> - - <!-- MAP DOWNLOAD --> - <string name="map_delete">Supprimer cette carte?</string> - <string name="map_download_title">Carte téléchargement</string> - <string name="map_download_downloading">Télécharger:</string> - <string name="map_download_eta">Temps restant</string> - <string name="map_download_ready">prêt</string> - <string name="map_download_download_error">Erreur de téléchargement carte</string> - <string name="map_download_download_aborted">Carte télécharger avortée</string> - <string name="map_download_not_enough_free_space">Pas assez d\'espace libre</string> - - <!-- ADDRESS SEARCH --> - <string name="address_search_title">Recherche d\'adresse</string> - <string name="address_enter_destination">Entrez votre destination</string> - <string name="address_partial_match">Correspondance partielle</string> - <string name="address_search_button">Chercher</string> - <string name="address_search_searching">Recherche en cours#8230;</string> - <string name="address_search_not_found">Adresse introuvable</string> - <string name="address_search_getting_results">Obtenir des résultats de recherche</string> - <string name="address_search_loading_results">Chargement des résultats de recherche</string> - <string name="address_search_no_results">Pas de résultats trouvés</string> - <string name="address_search_no_text_entered">Aucun texte entré</string> - <string name="address_search_set_destination">Destination fixée à:</string> - <string name="address_search_towns">Villes</string> - <string name="address_search_streets">Rues</string> -</resources> - diff --git a/navit/android/res/values-nl/strings.xml b/navit/android/res/values-nl/strings.xml deleted file mode 100644 index 0ef3656a3..000000000 --- a/navit/android/res/values-nl/strings.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <!-- LANG=nl --> - <!-- GENERIC --> - <!-- All generic strings fallback to default (en) --> - - <!-- NOTIFICATION --> - <string name="notification_name">@string/app_name</string> - <string name="notification_ticker">Navit gestart</string> - <string name="notification_event_default">Navit actief</string> - <string name="yes">Ja</string> - <string name="no">Nee</string> - - <!-- INITIAL INFOBOX --> - <string name="initial_info_box_title">Welkom bij Navit</string> - <string name="initial_info_box_message">Dank u voor het installeren van Navit!\n\nOm te beginnen, selecteer \"Download kaarten\" uit het menu en download een kaart van je regio. De kaarten zijn groot, dus is het aangeraden om een ongelimiteerde internetverbinding te hebben!\n\nKaartendata: CC-BY-SA OpenStreetMap Project\n\nNog veel plezier met Navit!</string> - <string name="initial_info_box_OK">OK</string> - <string name="initial_info_box_more_info">Meer info</string> - - <!-- OPTIONS MENU --> - <string name="optionsmenu_zoom_in">Inzoomen</string> - <string name="optionsmenu_zoom_out">Uitzoomen</string> - <string name="optionsmenu_download_maps">Download kaarten</string> - <string name="optionsmenu_toggle_poi">Schakel POIs</string> - <string name="optionsmenu_address_search">@string/address_search_title</string> - <string name="optionsmenu_exit_navit">Verlaat Navit</string> - - <!-- POSITION POP-UP --> - <string name="position_popup_title">Position</string> - <string name="position_popup_drive_here">Ga naar hier</string> - - <!-- MAP DOWNLOAD --> - <string name="map_delete">Verwijder deze kaart?</string> - <string name="map_download_title">Kaart downloaden</string> - <string name="map_download_downloading">Downloading:</string> - <string name="map_download_eta">Resterende tijd</string> - <string name="map_download_ready">klaar</string> - <string name="map_download_download_error">Fout met kaart downloaden</string> - <string name="map_download_download_aborted">Kaart downloaden afgebroken</string> - <string name="map_download_not_enough_free_space">Niet genoeg vrije ruimte</string> - - <!-- ADDRESS SEARCH --> - <string name="address_search_title">Zoek een adres</string> - <string name="address_enter_destination">Uwe bestemming</string> - <string name="address_partial_match">Partieel</string> - <string name="address_search_button">Zoek</string> - <string name="address_search_searching">Zoeken#8230;</string> - <string name="address_search_not_found">Adres niet gevonden</string> - <string name="address_search_getting_results">Zoekresultaten krijgen</string> - <string name="address_search_loading_results">Zoekresultaten laden</string> - <string name="address_search_no_results">Geen resultaten gevonden</string> - <string name="address_search_no_text_entered">Geen tekst ingevoerd</string> - <string name="address_search_set_destination">Bestemming ingesteld:</string> - <string name="address_search_towns">Steden</string> - <string name="address_search_streets">Straten</string> -</resources> - diff --git a/navit/android/res/values/strings-dont-translate.xml b/navit/android/res/values/strings-dont-translate.xml new file mode 100644 index 000000000..db794184f --- /dev/null +++ b/navit/android/res/values/strings-dont-translate.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <!-- LANG=en --> + <!-- GENERIC --> + <string name="app_name">Navit</string> + <string name="map_data_copyright">© OpenStreetMap contributors</string> + <string name="url_wiki_android">http://wiki.navit-project.org/index.php/Navit_on_Android</string> + <string name="url_wiki_main">http://wiki.navit-project.org</string> + + <!-- NOTIFICATION --> + <string name="notification_name">@string/app_name</string> + + <!-- OPTIONS MENU --> + <string name="optionsmenu_address_search">@string/address_search_title</string> + + <!-- Backup Restore --> + <string-array name="dialog_backup_restore_items"> + <item >@string/backup</item> + <item >@string/restore</item> + </string-array> +</resources> + diff --git a/navit/android/res/values/strings.xml b/navit/android/res/values/strings.xml index ce7d09f59..3081c0bc5 100644 --- a/navit/android/res/values/strings.xml +++ b/navit/android/res/values/strings.xml @@ -2,21 +2,16 @@ <resources> <!-- LANG=en --> <!-- GENERIC --> - <string name="app_name">Navit</string> - <string name="map_data_copyright">CC-BY-SA OpenStreetMap Project</string> - <string name="url_wiki_android">http://wiki.navit-project.org/index.php/Navit_on_Android</string> - <string name="url_wiki_main">http://wiki.navit-project.org</string> <string name="yes">Yes</string> <string name="no">No</string> <!-- NOTIFICATION --> - <string name="notification_name">@string/app_name</string> <string name="notification_ticker">Navit started</string> <string name="notification_event_default">Navit running</string> <!-- INITIAL INFOBOX --> <string name="initial_info_box_title">Welcome to Navit</string> - <string name="initial_info_box_message">Thank you for installing Navit!\n\nTo start, select \"Download maps\" from the menu to download a map. Note: The map filesize may be large (>50MB) - a wifi connection is recommended.\n\nMapdata: CC-BY-SA OpenStreetMap Project\n\nEnjoy Navit!</string> + <string name="initial_info_box_message">Thank you for installing Navit!\n\nTo start, select \"Download maps\" from the menu to download a map. Note: The map filesize may be large (>50MB) - a wifi connection is recommended.\n\nMapdata: (c) OpenStreetMap contributors\n\nEnjoy Navit!</string> <string name="initial_info_box_OK">OK</string> <string name="initial_info_box_more_info">More info</string> @@ -26,7 +21,6 @@ <string name="optionsmenu_zoom_out">Zoom out</string> <string name="optionsmenu_download_maps">Download maps</string> <string name="optionsmenu_toggle_poi">Toggle POIs</string> - <string name="optionsmenu_address_search">@string/address_search_title</string> <string name="optionsmenu_exit_navit">Exit Navit</string> <string name="optionsmenu_backup_restore">Backup / Restore</string> @@ -51,7 +45,7 @@ <string name="address_enter_destination">Enter destination</string> <string name="address_partial_match">Match partial address</string> <string name="address_search_button">Search</string> - <string name="address_search_searching">Searching#8230;</string> + <string name="address_search_searching">Searching...</string> <string name="address_search_not_found">Address not found</string> <string name="address_search_getting_results">Getting search results</string> <string name="address_search_loading_results">Loading search results</string> @@ -77,9 +71,5 @@ <string name="select_backup">Select backup</string> <string name="backup">Backup</string> <string name="restore">Restore</string> - <string-array name="dialog_backup_restore_items"> - <item >@string/backup</item> - <item >@string/restore</item> - </string-array> </resources> |