kopia lustrzana https://gitlab.com/sane-project/backends
Added basic support for translating option descriptions and titles
of SANE backends. This is really alpha! Henning Meier-Geinitz <henning@meier-geinitz.de>DEVEL_2_0_BRANCH-1
rodzic
0b010c4056
commit
cb9cff4e1b
|
@ -0,0 +1,96 @@
|
|||
# Enter additional backends and backend files with translatable
|
||||
# text here
|
||||
|
||||
ALL_BACKENDS = epson mustek mustek_usb umax
|
||||
|
||||
all:
|
||||
|
||||
epson.pot: ../backend/epson.c ../backend/epson.h
|
||||
mustek.pot: ../backend/mustek.c
|
||||
mustek_usb.pot: ../backend/mustek_usb.c
|
||||
umax.pot: ../backend/umax.c
|
||||
|
||||
# end of configuration
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datadir = @datadir@
|
||||
localedir = $(datadir)/locale
|
||||
gnulocaledir = $(prefix)/share/locale
|
||||
top_srcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
MKDIR = $(top_srcdir)/mkinstalldirs
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
OPTS = ../include/sane/saneopts.h
|
||||
TMP_FILE_DIR = .tmp
|
||||
ALL_POTS =$(foreach be,$(ALL_BACKENDS),$(addprefix $(be),.pot))
|
||||
|
||||
INSTALL_TRANSLATIONS = @INSTALL_TRANSLATIONS@
|
||||
.SUFFIXES: .po .mo
|
||||
|
||||
.po.mo:
|
||||
msgfmt -o $@ $<
|
||||
|
||||
%.pot: $(OPTS)
|
||||
@rm -rf $(TMP_FILE_DIR)
|
||||
@mkdir $(TMP_FILE_DIR) && \
|
||||
for file in $^ ; do \
|
||||
echo parsing $${file} ; \
|
||||
sed < $${file} -e 's/#define//g' \
|
||||
> $(TMP_FILE_DIR)/`basename $${file}` ; \
|
||||
done && \
|
||||
xgettext -d$* -kSANE_I18N $(TMP_FILE_DIR)/*.* && \
|
||||
mv $*.po $*.pot
|
||||
|
||||
update-pot: $(ALL_POTS)
|
||||
|
||||
update-po: $(ALL_POTS)
|
||||
@pots="$(subst .pot,,$^)" ; \
|
||||
for po_file in *.po ; do \
|
||||
backend=`echo "$${po_file}" | sed -e "s/\..*$$//"` && \
|
||||
echo updating $${po_file} from $${backend}.pot && \
|
||||
cp $${po_file} $${po_file}.old && \
|
||||
msgmerge $${po_file}.old $${backend}.pot -o $${po_file} && \
|
||||
rm $${po_file}.old ; \
|
||||
done
|
||||
|
||||
update-mo:
|
||||
@for po_file in *.po ; do \
|
||||
mo_file=`echo $${po_file} | sed -e "s/\.po$$/.mo/"` ; \
|
||||
$(MAKE) $${mo_file} ; \
|
||||
done
|
||||
|
||||
install-translations: update-mo
|
||||
@for mo_file in *.mo ; do \
|
||||
lang=`echo $${mo_file} | sed -e "s/\.mo$$//" -e "s/^.*\.//" ` ; \
|
||||
backend=`echo $${mo_file} | sed -e "s/\..*$$//"` ; \
|
||||
dir=$(gnulocaledir)/$${lang}/LC_MESSAGES ; \
|
||||
echo installing sane-$${backend}.mo from $${mo_file} in $${dir} ; \
|
||||
$(MKDIR) $${dir} ; \
|
||||
$(INSTALL_DATA) $${mo_file} $${dir}/sane-$${backend}.mo ; \
|
||||
done
|
||||
|
||||
|
||||
install: $(INSTALL_TRANSLATIONS)
|
||||
|
||||
uninstall:
|
||||
|
||||
clean:
|
||||
rm -f *.mo
|
||||
rm -f *.old
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile
|
||||
rm -f *~
|
||||
rm -f *.pot
|
||||
rm -rf $(TMP_FILE_DIR)
|
||||
|
||||
depend:
|
||||
|
||||
.PHONY: all clean distclean depend install uninstall install-translations \
|
||||
update-pot update-po update-mo
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
2002-01-07
|
||||
|
||||
This directory contains translations for the options of the SANE backends.
|
||||
They are only used if configure is called with option --enable-translations.
|
||||
Currently these translations are only used by XSane.
|
||||
|
||||
What do you need to do if you want to:
|
||||
|
||||
- Just read the description of SANE options in your language
|
||||
* Use XSane, read the documentation and set LANG to your favorite
|
||||
setting (e.g. de_DE for German in Germany).
|
||||
|
||||
- Update existing translations when the source code has changed
|
||||
* cd po ; make update-po
|
||||
* Edit backend.lang.po, add/change translations.
|
||||
* make
|
||||
|
||||
- Add a new language
|
||||
* cd po ; make update-pot
|
||||
* cp backend.pot backend.lang.pot
|
||||
* Edit backend-lang.po, enter translations. Don't forget to edit the header.
|
||||
* make update-mo ; make install
|
||||
|
||||
- Add a translation for a backend that is not listed yet in Makefile.in
|
||||
* Edit your sources and add SANE_I18N to the appropriate strings. Mark the
|
||||
descriptions (desc) and titles of options with SANE_I18N(). Do the same
|
||||
for string lists used in options. The name of options must NOT be marked.
|
||||
Do NOT mark macros. Especially you don't need to mark standard option
|
||||
strings like SANE_TITLE_NUM_OPTIONS as this is already done in saneopts.h.
|
||||
Example: s->opt[5].title = SANE_I18N("Enhancement");
|
||||
* Edit Makefile.in. Add your backend to ALL_BACKENDS and ass a line
|
||||
"backend.pot: yourfiles" where yourfiles is a list of all your files
|
||||
containing translatable text.
|
||||
* configure --enable-translations
|
||||
* cd po ; make update-pot
|
||||
* cp backend.pot backend.lang.pot
|
||||
* Edit backend-lang.po, enter translations. Don't forget to edit the header.
|
||||
* make update-mo ; make install
|
||||
|
||||
Bugs:
|
||||
- This is the first attempt to support translations. It's probably very buggy
|
||||
and nearly untested.
|
||||
- Lot's of ugly tricks and asumptions in Makefile.in
|
||||
- Documentation isn't finished
|
Ładowanie…
Reference in New Issue