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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
For unicode command line characters Windows uses UTF-16, while Glib
and GTK use UTF-8. To solve that we retrieve the command line
via __wgetmainargs() and use g_utf16_to_utf8() to convert each argument.
The used method should support wildcards passed as arguments
(e.g. *.xml).
Two new, OS abstracted functions appear in linux.c (NOP), macos.c (NOP),
windows.c:
subsurface_command_line_init(...)
subsurface_command_line_exit(...)
which are being called in main()
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was in a patch set from Henrik but got dropped at first while we
explored a different solution. So now it comes back as maybe the most
trivial commit, ever :-)
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are a couple of gothas on MacOSX involving GateKeeper on
Mountain Lion, and dialogues that sometimes doesn't pop up. This
file explains that. The file should be included in the DMG, but that's
for a different commit.
[Dirk Hohndel: fix whitespace and some rephrasing]
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On Windows, the GLib wrappers for fopen() and open() deal with the UTF-8
format used for file names when we have to open or save a file with
unicode characters in its name.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This still seems to fail to open the icon in the About screen in some
cases, but we don't quite understand why...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fixed a couple of typos.
[Dirk Hohndel: I took the typo fixes, but not the change of shell used;
rewrote the commit message accordingly]
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Renamed to "Import XML File(s)", since we can import more than one file.
H
From 8f9b11d940d903316dcf4d023e327f365e4f4ccb Mon Sep 17 00:00:00 2001
From: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Date: Tue, 2 Oct 2012 11:38:56 +0200
Subject: [PATCH] Rename Import XML File menu entry
Renamed to "Import XML File(s)", since we can import more than one file.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In divelist.c:get_string(), when truncating the string to a maximum
of 60 characters (to be shown in the divelist), make sure we are
counting in guinchar (sizeof usually 2) instead of gchar (sizeof usually 1).
Use Glib functions such as g_utf8_strlen() and g_utf8_strncpy() to do that.
This patch fixes the potential problem when truncating a UTF-8 string
by calculating its length using strlen() in bytes.
For char = 1 byte, if the length returned by strlen() is an odd number
this means there is at least one single byte length character in there.
But also if the same string has a UTF-8 character at exactly the truncate
position minus x(probably 1) bytes, we are going to split the bytes
forming said UTF-8 char resulting in an incorrect string.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In dive.c:fixup_dive() it would be better to call functions
like add_people() and add_location() before the possible return
in the "if (end < 0)" branch.
This prevents a partial auto-complete list in "Dive Info"
combo boxes.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When creating a new dive_trip from a dive, we should probably
always copy the location via strdup(). However we then have to take
care of the de-allocation in divelist.c:delete_trip()
and gtk-gui.c:file_close().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added new function dive_list_destroy() in divelist.c
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
move_dive_between_trips() always returns a pointer to a new
allocated memory block of size = GtkTreeIter. Lets free said memory
when no longer needed in the caller functions.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I couldn't figure out how the current packaging infrastructure was supposed to
work, but with not too much work I could get the more standard gtk-mac-bundler
to do what I wanted, so I added the support files needed for that and a little
README on how to use them.
The subsurface.sh and subsurface.bundle files are based on the launcher.sh
and gtk-demo.bundle files from the gtk-mac-bundler release which is under GPLv2.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Looks like a GtkEntryCompletion object created with
gtk_entry_completion_new() should be unreferenced after usage
(e.g. post gtk_entry_set_completion())
In info.c:get_combo_box_entry_text(), moved the free(..) line outside,
so that we can free regardless.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch makes the trips nest, and it also fixes the fact that you never
saved the trip notes (you could edit it, but saving would throw it away).
I did *not* change the indentation of the dives, so the trip stuff shows
up the the beginning of the line, at the same level as the <dive> and
<dives> thing. I think it's fairly readable xml, though, and we haven't
really had proper "indentation shows nesting" anyway, since the top-level
"<dives>" thing also didn't indent stuff inside of it.
Anyway, the way I wrote it, it still parses your old "INTRIP" stuff etc,
so as far as I know, it should happily read the old-style XML too. At
least it seemed to work with your xml file that already had the old-style
one (I haven't committed my divetrips, exactly because I didn't like the
new format).
It always saves in the new style, though.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The return value of subsurface_get_conf is a const void * - so we shouldn't
just assign it to a variable where we know it will be changed. Instead we
duplicate the string and free the original one. A little less efficient but
cleaner.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>