Commit graph

1002 commits

Author SHA1 Message Date
Dirk Hohndel
bfd6ce0f1f Localization prevents us from from making assumptions about string length
Restructure some code to work around that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 08:33:03 -07:00
Henrik Brautaset Aronsen
f45285d461 Support for language aliases.
Some languages have identifiers that gettext can't determine
automatically in all OS'es.  An example is Norwegian (no_NO, deprecated)
with its Bokmål (nb_NO) and Nynorsk (nn_NO) form.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 07:30:59 -07:00
Dirk Hohndel
9dc667e883 Renamed the Norwegian .po file
At least on Windows this now will make things work correctly, as the gtk
localization is named nb - so nb_NO.UTF-8 is consistent with that.

MacOS still appears to need some special handling.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 04:30:07 -07:00
Henrik Brautaset Aronsen
f03d29b48b Added a terrible spanish translation.
I don't know any Spanish at all. This translation was made with
Google Translate, perl and sed, and will annoy anyone who knows
Spanish.  Hopefully enough so that they will fix it.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 04:09:22 -07:00
Dirk Hohndel
a9f3655d1a Improved packaging for Windows
This commit adds an install-cross-windows target to the Makefile that
creates a staging directory for us under packaging/windows that contains
the required .mo files. This currently fails for the Norwegian translation
because of the no_NO.UTF-8 vs nb issue - right now we just use the first
component of our own localization filename to find the matching Windows
localization and that fails.

The subsurface.nsi file is updated accordingly and this now appears to
create working installers with sane paths for the localization files.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 04:08:33 -07:00
Lubomir I. Ivanov
5bf6723d26 More fixes in the Bulgarian translation
- Added the missing statistics translations
- Clearer translation in the Dive->View submenu

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 02:25:16 -07:00
Henrik Brautaset Aronsen
ea48829ba5 Updated Norwegian translation
Dirk had some changes in commit f1569a206e

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 02:17:52 -07:00
Lubomir I. Ivanov
cc08e03678 subsurface.nsi: call RMDir for the 'share' and 'locale' subfolders
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 02:16:42 -07:00
Dirk Hohndel
fada2f6bc6 Better Windows installer .nsi file
This still requires on carefully staged files in the packaging/windows
directory. Specifically:

- the dll directory (or symlink) points to the installed gtk Windows DLLs
- the mydll directory (or symlink) contains six other DLLs (where the
  cross built DLLs from Fedora for some reason file, but can be
  transparently replaced with the ones from the upstream binary
  package
- the share directory contains the Windows gtk locale files (but only for
  the locales that we support, anyway)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 21:27:16 -07:00
Jozef Ivanecký
ac3124b8d0 Update Slovak translation
Signed-Off-By: Jozef Ivanecký (dodo.sk@gmail.com)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 16:34:28 -07:00
Dirk Hohndel
f97f75f961 Set locale under Windows
This is mostly a quick hack to be able to test localization under Windows.
It seems to work fine under Windows 7

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 16:32:11 -07:00
Dirk Hohndel
72c7d7c9c4 Small adjustments to the German translation
Consistently use "Ø" for average.

Use Tauchgruppenleiter and Leiter instead of Tauchgruppenführer and
Führer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 15:23:16 -07:00
Dirk Hohndel
9b9e36886c Forgot to localize names of months and weekdays
We marked the strings for translation, but then didn't actually call the
translation function on them.

Our dates are still not truely localized as we have hand written code for
the date / time handling that constructs the dates according to US fashion
as [Weekday], [Month] [Day of Month], [Year] [hh:mm]

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 14:37:59 -07:00
Tommi Saviranta
0cee29121d Updated Finnish translation
- Use message context for better translation
- Fixed some strings to form proper sentences

Signed-off-by: Tommi Saviranta <wnd@iki.fi>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 13:34:37 -07:00
Dirk Hohndel
7e703b7a1d Fix incorrect localization of dialog name
The existing code passed a localized copy of a text buffer initialized by
a static string to a function that ended up wanting to modify the buffer.
Unsurprisingly, that doesn't work. This commit restructures the code so
that we initialize the buffer at run time with a localized version of the
default string and then just pass the buffer around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 13:29:37 -07:00
Lubomir I. Ivanov
dc7a831cde Improved Bulgarian translation
- Shortened long phrases
- Better lowercase/uppercase consistency
- Fixed a couple of typos

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 11:15:10 -07:00
Ivan Habunek
00eb9bde56 Initial Croatian translation.
Signed-off-by: Ivan Habunek <ivan.habunek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 10:02:44 -07:00
Martin Gysel
da2a0562ab Swiss-High-German translation
Here's the Swiss-(High-)German translation which is mostly based on the
German translation.

Most notable differences are:
- in Switzerland, 'ß' doesn't exist (fortunately)
- keep some English words where the German translation sounds strange or
  unfamiliar (nobody in Switzerland would ever use the word
  Tauchgruppenführer)

Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 09:42:55 -07:00
Dirk Hohndel
4b9a59a154 Merge branch 'gettext'
Bring all the localization changes into master in preparation for
Subsurface 2.1
2012-10-15 09:37:09 -07:00
Henrik Brautaset Aronsen
ef039c9d32 Support for gettext in MacOSX application bundle
The MacOSX applications bundle needs to be told where to bind the
text domain from.

Also copy the gettext .mo files in the install-macosx target.

[Dirk Hohndel: minor change in main(): move the path declaration to
               the beginning of the function]

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 09:36:30 -07:00
jnoel
5c432d3c8a Update po/fr_FR.po
Just a few spelling corrections for fr_FR translation file

Signed-off-by: Jean-Noël Rouchon <jnoel@sissiou.net>
2012-10-15 09:34:37 -07:00
Dirk Hohndel
f1569a206e Improve translations
- fix two missing strings in equipment.c (thanks to Tommi Saviranta for
  pointing this out)

- add context for the translations of the Yearly/monthly statistics. The code
  for this ended up being incredibly ugly, but the gettext infrastructure
  really clashed with the way this is implemented. What I have now at least
  works (tested with the German translation)

- merge the new strings into all the po files. The non-German translations need
  to be updated. Make sure you remove the "# , fuzzy" lines or the current
  Makefile will ignore those additions.

- some minor cleanup of the po files (many listed the wrong language, all of
  them copied my incorrect use of PACKAGE (instead of saying "Subsurface").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-14 20:47:00 -07:00
Miika Turkia
a3e7a46f12 Change character encoding from iso-8859-1 to UTF8
Finnish translation was with wrong character encoding resulting in
compile error.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-13 17:04:43 -07:00
Dirk Hohndel
cb4bdfcea1 Improve German translations
The changes were mostly suggested by Lutz, but since he didn't send a
patch, I manually applied them.

Suggested-by: Lutz Vieweg <lvml@5t9.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-13 17:02:58 -07:00
Tommi Saviranta
8cc538ddd3 Add Finnish translation
This translation is partly based on Finnish Divers' Federation's printed
dive log and partly on my best guess. Some of the translated strings
have been (badly) shortened to fit the UI, and many others still neen be
shortened.

Signed-off-by: Tommi Saviranta <wnd@iki.fi>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-13 09:29:09 -07:00
Ďoďo
d27eb4f503 Slovak translation
Also fixed two typos in the German translations.

Signed-Off-By: Jozef Ivanecký (dodo.sk@gmail.com)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-13 09:01:25 -07:00
Pierre-Yves Chibon
549425a692 Created first french translation of Subsurface
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 12:22:36 -07:00
Henrik Brautaset Aronsen
cfaa5563bf Better gettext build
My previous take at adding gettext to the Makefile wasn't very good,
since it always relinked the subsurface executable.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 12:17:09 -07:00
Linus Torvalds
920c1e58ff Add Swedish translation
This is a horrible mish-mash of the english and norwegian translation
and my random odd swedish translations of them.

It's bad. But it's a starting point. If somebody complains, they
hopefully say things like "That should be xyz" and it can be fixed.

[Dirk Hohndel: minor edit to the .po file to at least no longer claim to
               be Norwegian...]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 12:37:22 +09:00
Dirk Hohndel
efb1928d51 Add translation files to the Windows installer package
A lot more needs to happen for localization on Windows, but this is the
first step.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 12:33:24 +09:00
Lubomir I. Ivanov
fcb09c8078 Add Bulgarian translation
Some of the exact translations of terminology such as SAC (ППК) might
need a revision by an expert. Also, some of the things ended up being up
2-3 times longer (similar to German), so I'm not sure how this is going to
reflect on the UI.

[Dirk Hohndel: minor fixes to the .po file to make it compile]

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 06:52:12 +09:00
Dirk Hohndel
5801dcf78b Use lang_COUNTRY.po naming convention for translation files
Rename nl.po to nl_NL.po

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 06:39:18 +09:00
Henrik Brautaset Aronsen
134c76ab80 Updated Norwegian translation
Added the missing translations for the File menu et al.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 06:32:26 +09:00
Dirk Hohndel
a68945646d Update German translations for newly added menu strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 23:15:08 +09:00
Dirk Hohndel
45e84618f5 Make translations of menu entries explicit
It appears that at least for Norwegian the translations of the stock menu
entries was missing. This patch adds those as explicit strings and merges
those new strings into the .po files.

The translations need to be updated in separate commits.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 23:08:45 +09:00
Jacco van Koll
2a6db9c7ae Add Dutch localization
Signed-off-by: Jacco van Koll <jacco.van.koll@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 22:27:16 +09:00
Dirk Hohndel
d4a3ecedb0 Get divelist headers localized, too
This fixes an oversight in commit 881a2df83616 ("Conversion to gettext to
allow localization") - string literals that are marked with N_ need to be
converted when the corresponding variables are used at runtime. This was
missed for the divelist headers.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 22:03:10 +09:00
Henrik Brautaset Aronsen
f5de37dbcf Basic gettext support when building
Added basic support for building gettext locales in the Makefile.
The po file name should match the target locale.

[Dirk Hohndel: Used git mv to rename the German .po file]

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 21:45:30 +09:00
Henrik Brautaset Aronsen
21dec2a134 More gtk-mac-bundler improvements
Without "-headerpad_max_install_names", gtk-mac-bundler would complain
with "changing install names or rpaths can't be redone for:
/Applications/.subsurface.app/Contents/MacOS/subsurface-bin (for
architecture x86_64) because larger updated load commands do not fit"

Also, libdivecomputer needs to be configured with --with-prefix=/opt/local

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 21:37:54 +09:00
Henrik Brautaset Aronsen
870978331e Add Norwegian Bokmål translation
This file was created with "msginit --locale=no_NO --input=deutsch.po"
and edited with poedit afterwards.

The correct locale for Norwegian Bokmål really is nb_NO, but this is
a new-ish construct, and that locale doesn't seem to be available
on MacOSX.  We might need to create .mo files in both
locale/no_NO.UTF-8 and locale/nb_NO.UTF-8 to satisfy all platforms.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 21:27:30 +09:00
Linus Torvalds
94c98865a7 Improve on the DivingLog importer a bit
This adds a few fields that we parse, but more importantly it also tries
to dynamically decide if the sample temperatures and pressures are in
imperial or metric units.

Dirk suspects that DivingLog generally always does everything in metric,
and the reason why he has crazy sample data in imperial units (both for
pressure and temperature) may be due to a bug in the early Uemis
importer for DivingLog.

Which would actually make a lot more sense than DivingLog really being
so insane on purpose.

Anyway, Dirk's brother Jurgen seems to have everything in metric units,
which would be much saner.  Maybe we should throw away the support for
insane DivingLog files entirely, since it is possible that the only use
ever of the possible source of that bug was Dirk's use of the Uemis
importer.

But for now, we end up just guessing. Current guesses:

 - water temperature is below 32 dgC, so 32+ degrees is in Fahrenheit.

 - tank pressures are below 400 bar, so higher values than that must be
   psi.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 15:13:39 +09:00
Dirk Hohndel
99846da77f Conversion to gettext to allow localization
This is just the first step - convert the string literals, try to catch
all the places where this isn't possible and the program needs to convert
string constants at runtime (those are the N_ macros).

Add a very rough first German localization so I can at least test what I
have done. Seriously, I have never used a localized OS, so I am certain
that I have many of the 'standard' translations wrong. Someone please take
over :-)

Major issues with this:

- right now it hardcodes the search path for the message catalog to be
  ./locale - that's of course bogus, but it works well while doing initial
  testing. Once the tooling support is there we just should use the OS
  default.

- even though de_DE defaults to ISO-8859-15 (or ISO-8859-1 - the internets
  can't seem to agree) I went with UTF-8 as that is what Gtk appears to
  want to use internally. ISO-8859-15 encoded .mo files create funny
  looking artefacts instead of Umlaute.

- no support at all in the Makefile - I was hoping someone with more
  experience in how to best set this up would contribute a good set of
  Makefile rules - likely this will help fix the first issue in that it
  will also install the .mo file(s) in the correct place(s)

  For now simply run

  msgfmt -c -o subsurface.mo deutsch.po

  to create the subsurface.mo file and then move it to
  ./locale/de_DE.UTF-8/LC_MESSAGES/subsurface.mo

  If you make changes to the sources and need to add new strings to be
  translated, this is what seems to work (again, should be tooled through
  the Makefile):

  xgettext -o subsurface-new.pot -s -k_ -kN_ --add-comments="++GETTEXT" *.c
  msgmerge -s -U po/deutsch.po subsurface-new.pot

  If you do this PLEASE do one commit that just has the new msgid as
  changes in line numbers create a TON of diff-noise. Do changes to
  translations in a SEPARATE commit.

- no testing at all on Windows or Mac
  It builds on Windows :-)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 10:03:03 +09:00
Dirk Hohndel
a2afe41280 A file that we import should never become the default file we save to
Only files that are opened should be considered r/w. Files that are
imported should be treated as if they were r/o.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-09 21:50:16 +09:00
Lubomir I. Ivanov
ffd3b8591d subsurface.nsi: install program shortcuts for all users
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.7.7:
"Sets the context of $SMPROGRAMS and other shell folders. If set
to 'current' (the default), the current user's shell folders are used.
If set to 'all', the 'all users' shell folder is used"

Specific to the Windows installer.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-09 16:32:05 +09:00
Dirk Hohndel
856e10ddb2 Add trip above adds all consecutive selected dives to the new trip
Before this commit we had the odd behavior that if we right clicked in the
middle of a group of selected dives, the trip was added above the dive we
clicked on, not above the group.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-09 16:32:05 +09:00
Dirk Hohndel
14856aab4b Bump version to 2.0.1
That crash is far too easy to hit for people just trying out subsurface.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-07 21:02:48 +09:00
Dirk Hohndel
1a6cf2f128 Fix potential crash when attempting to free default font
Before setting a new font we try to free the existing font. Sadly if no
config value is set for the default font, we assign a string literal.
Which of course means that subsurface dumps core when trying to free it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-07 20:57:24 +09:00
Dirk Hohndel
b4c11a7ed3 Turn menu and button images on regardless of OS settings.
Right now the menu and button images are a distribution choice - some
have them on, some have them off. I kinda like them and think that even on
OSs that have them off by default this doesn't look out of place (as other
apps clearly do the same).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-06 05:26:55 +09:00
Lubomir I. Ivanov
3e7780e7cd Added unicode support for the configuration entries on Windows
windows.c:

Windows's registry (which is technically a filesystem) uses UTF-16
for its "keys". This forces us to convert each of our UTF-8 (GLib, GTK)
configuration entries if we want to store special characters. To do that
we use the RegQueryValueExW() and do some conversation around
the function call itself.

The opposite happens when we require a UTF-16 value to be read from the
registry and converted to UTF-8 in subsurface_set_conf().

An addition to this patch is a somehow expandable buffer in
windows.c: subsurface_get_conf(). We increase the size of the buffer
in chunks of 64 bytes, until RegQueryValueExW() is able to write to it
(as suggested by the WINAPI documentation).

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-05 23:44:54 +09:00
Lubomir I. Ivanov
b272fb8c3b Fixed some memory leaks related to string configuration entries
Each time we retrieve a string configuration entry via
subsurface_get_conf(), all the multiplatform methods in linux.c,
macos.c, windows.c allocate memory for the returned value.

In gtk-gui.c, lets try to release the memory at:
default_dive_computer_vendor, default_dive_computer_product, divelist_font
before assigning a new address to these pointers.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-05 23:44:37 +09:00