Debian Codegraph @

files/lang/Makefile

raw symbols SCIP
1 ###########################################################################
2 # fheroes2: https://github.com/ihhub/fheroes2 #
3 # Copyright (C) 2024 - 2026 #
4 # #
5 # This program is free software; you can redistribute it and/or modify #
6 # it under the terms of the GNU General Public License as published by #
7 # the Free Software Foundation; either version 2 of the License, or #
8 # (at your option) any later version. #
9 # #
10 # This program is distributed in the hope that it will be useful, #
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
13 # GNU General Public License for more details. #
14 # #
15 # You should have received a copy of the GNU General Public License #
16 # along with this program; if not, write to the #
17 # Free Software Foundation, Inc., #
18 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
19 ###########################################################################
20
21 ICONV = iconv
22 # TODO: consider converting game fonts and texts to UTF-8 in the engine instead
23 MSGFMT = sed -e '1,20 s/UTF-8/$(1)/' $< | $(ICONV) -f utf-8 -t $(1) | if msgfmt --help | grep -q no-convert >/dev/null 2>/dev/null; then msgfmt - -o $@ --no-convert; else msgfmt - -o $@; fi
24
25 .PHONY: all clean merge
26
27 all: $(patsubst %.po, %.mo, $(wildcard *.po))
28
29 merge: ../../src/dist/fheroes2/fheroes2.pot
30 for i in $(wildcard *.po); do msgmerge -U --no-location $$i $<; done
31
32 # Czech, Hungarian, Polish and Slovak versions use CP1250
33 cs.mo hu.mo pl.mo sk.mo: %.mo: %.po
34 $(call MSGFMT,CP1250)
35
36 # Belarusian, Bulgarian, Ukrainian versions use CP1251
37 # Russian versions from "Buka" and "XXI vek" use CP1251 encoding (supported)
38 # Russian version from "Fargus" uses Russian keyboard layout as encoding (not supported)
39 be.mo bg.mo ru.mo uk.mo: %.mo: %.po
40 $(call MSGFMT,CP1251)
41
42 # German, Danish, French, Italian, Dutch, Norwegian, Portuguese, Spanish and Swedish translations use CP1252
43 de.mo da.mo es.mo fr.mo it.mo nb.mo pt.mo sv.mo nl.mo: %.mo: %.po
44 $(call MSGFMT,CP1252)
45
46 # Greek uses CP1253
47 el.mo: el.po
48 $(call MSGFMT,CP1253)
49
50 # Turkish uses CP1254
51 tr.mo: tr.po
52 $(call MSGFMT,CP1254)
53
54 # Lithaunian uses CP1257
55 lt.mo: lt.po
56 $(call MSGFMT,CP1257)
57
58 # Vietnamese uses CP1258
59 vi.mo: vi.po
60 $(call MSGFMT,CP1258)
61
62 # Romanian uses ISO-8859-16
63 ro.mo: ro.po
64 $(call MSGFMT,ISO-8859-16)
65
66 # Esperanto uses ISO-8859-3
67 eo.mo: eo.po
68 $(call MSGFMT,ISO-8859-3)
69
70 # All other languages: drop accents transliterated with `"` (which breaks translation file format)
71 # and transliterate the rest with default iconv rules
72 %.mo: %.po
73 sed -e 'y/äëïöőüűÄËÏŐÖÜŰ/aeioouuAEIOOUU/' $< | $(ICONV) -f utf-8 -t ascii//TRANSLIT | msgfmt - -o $@
74
75 clean:
76 -rm -f *.mo *.po~