summarylogtreecommitdiffstats
path: root/fix-locale-translations.patch
blob: ef9bd46073f0576c1a3cbc6535ebd8f4eb2b704a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -1,66 +1,71 @@
-FILE (GLOB PO_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.po")
-
-INCLUDE (CMakeDependentOption)
+file (GLOB PO_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.po")
+include (CMakeDependentOption)
 
-FUNCTION (SetTranslationOption PoName DefaultMode)
-	SET (LangName "${PoName}")
-	STRING (REGEX REPLACE "^ar$"	"Arabic"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^ast$"	"Asturian"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^bg$"	"Bulgarian"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^ca$"	"Catalan"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^cs$"	"Czech"			LangName "${LangName}")
-	STRING (REGEX REPLACE "^da$"	"Danish"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^de$"	"German"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^el$"	"Greek"			LangName "${LangName}")
-	STRING (REGEX REPLACE "^en_GB$"	"English"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^es$"	"Spanish"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^et_EE$"	"Estonian"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^eu$"	"Basque"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^fi$"	"Finnish"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^fr$"	"French"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^gl$"	"Galician"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^he$"	"Hebrew"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^hr$"	"Croatian"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^hu$"	"Hungarian"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^it$"	"Italian"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^it_CH$"	"Italian (Swiss)"	LangName "${LangName}")
-	STRING (REGEX REPLACE "^ja$"	"Japanese"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^ko_KR$"	"Korean"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^lt$"	"Lithuanian"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^nl$"	"Dutch"			LangName "${LangName}")
-	STRING (REGEX REPLACE "^nn$"	"Norwegian (Nynorsk)"	LangName "${LangName}")
-	STRING (REGEX REPLACE "^pl$"	"Polish"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^pt_BR$"	"Portuguese (Brazilian)" LangName "${LangName}")
-	STRING (REGEX REPLACE "^pt_PT$"	"Portuguese"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^ru$"	"Russian"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^sl$"	"Slovenian"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^sq$"	"Albanian"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^sv$"	"Swedish"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^tr$"	"Turkish"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^uk$"	"Ukrainian"		LangName "${LangName}")
-	STRING (REGEX REPLACE "^zh_CN$"	"Chinese (Simplified)"	LangName "${LangName}")
-	STRING (REGEX REPLACE "^zh_TW$"	"Chinese (Traditional)"	LangName "${LangName}")
-	CMAKE_DEPENDENT_OPTION (TRANSLATION_${PoName} "Build ${LangName} translation" ${DefaultMode} ENABLE_NLS OFF)
-ENDFUNCTION (SetTranslationOption)
+function (SetTranslationOption PoName DefaultMode)
+	set (LangName "${PoName}")
+	string (REGEX REPLACE "^ar$"	"Arabic"		LangName "${LangName}")
+	string (REGEX REPLACE "^ast$"	"Asturian"		LangName "${LangName}")
+	string (REGEX REPLACE "^bg$"	"Bulgarian"		LangName "${LangName}")
+	string (REGEX REPLACE "^ca$"	"Catalan"		LangName "${LangName}")
+	string (REGEX REPLACE "^cs$"	"Czech"			LangName "${LangName}")
+	string (REGEX REPLACE "^da$"	"Danish"		LangName "${LangName}")
+	string (REGEX REPLACE "^de$"	"German"		LangName "${LangName}")
+	string (REGEX REPLACE "^el$"	"Greek"			LangName "${LangName}")
+	string (REGEX REPLACE "^en_GB$"	"English"		LangName "${LangName}")
+	string (REGEX REPLACE "^es$"	"Spanish"		LangName "${LangName}")
+	string (REGEX REPLACE "^et_EE$"	"Estonian"		LangName "${LangName}")
+	string (REGEX REPLACE "^eu$"	"Basque"		LangName "${LangName}")
+	string (REGEX REPLACE "^fi$"	"Finnish"		LangName "${LangName}")
+	string (REGEX REPLACE "^fr$"	"French"		LangName "${LangName}")
+	string (REGEX REPLACE "^gl$"	"Galician"		LangName "${LangName}")
+	string (REGEX REPLACE "^he$"	"Hebrew"		LangName "${LangName}")
+	string (REGEX REPLACE "^hr$"	"Croatian"		LangName "${LangName}")
+	string (REGEX REPLACE "^hu$"	"Hungarian"		LangName "${LangName}")
+	string (REGEX REPLACE "^it$"	"Italian"		LangName "${LangName}")
+	string (REGEX REPLACE "^it_CH$"	"Italian (Swiss)"	LangName "${LangName}")
+	string (REGEX REPLACE "^ja$"	"Japanese"		LangName "${LangName}")
+	string (REGEX REPLACE "^ko_KR$"	"Korean"		LangName "${LangName}")
+	string (REGEX REPLACE "^lt$"	"Lithuanian"		LangName "${LangName}")
+	string (REGEX REPLACE "^nl$"	"Dutch"			LangName "${LangName}")
+	string (REGEX REPLACE "^nn$"	"Norwegian (Nynorsk)"	LangName "${LangName}")
+	string (REGEX REPLACE "^pl$"	"Polish"		LangName "${LangName}")
+	string (REGEX REPLACE "^pt_BR$"	"Portuguese (Brazilian)" LangName "${LangName}")
+	string (REGEX REPLACE "^pt_PT$"	"Portuguese"		LangName "${LangName}")
+	string (REGEX REPLACE "^ro$"	"Romanian"		LangName "${LangName}")
+	string (REGEX REPLACE "^ru$"	"Russian"		LangName "${LangName}")
+	string (REGEX REPLACE "^sl$"	"Slovenian"		LangName "${LangName}")
+	string (REGEX REPLACE "^sq$"	"Albanian"		LangName "${LangName}")
+	string (REGEX REPLACE "^sv$"	"Swedish"		LangName "${LangName}")
+	string (REGEX REPLACE "^tr$"	"Turkish"		LangName "${LangName}")
+	string (REGEX REPLACE "^uk$"	"Ukrainian"		LangName "${LangName}")
+	string (REGEX REPLACE "^zh_CN$"	"Chinese (Simplified)"	LangName "${LangName}")
+	string (REGEX REPLACE "^zh_TW$"	"Chinese (Traditional)"	LangName "${LangName}")
+	cmake_dependent_option (TRANSLATION_${PoName} "Build ${LangName} translation" ${DefaultMode} ENABLE_NLS OFF)
+endfunction()
 
-FOREACH (PO_FILE ${PO_FILES})
-	STRING (REGEX REPLACE ".po" "" PO_FILE ${PO_FILE})
+foreach (PO_FILE ${PO_FILES})
+	string (REGEX REPLACE ".po" "" PO_FILE ${PO_FILE})
 
-	IF (TRANSLATIONS)
-		STRING (REGEX MATCH "${PO_FILE}," TRANS "${TRANSLATIONS}")
+	if (TRANSLATIONS)
+		string (REGEX MATCH "${PO_FILE}," TRANS "${TRANSLATIONS}")
 
-		IF (TRANS)
+		if (TRANS)
 			SetTranslationOption ("${PO_FILE}" ON)
-		ELSE (TRANS)
+		else()
 			SetTranslationOption ("${PO_FILE}" OFF)
-		ENDIF (TRANS)
-	ELSE (TRANSLATIONS)
+		endif()
+	else()
 		SetTranslationOption ("${PO_FILE}" ON)
-	ENDIF (TRANSLATIONS)
+	endif()
 
-	IF (TRANSLATION_${PO_FILE})
-		LIST (APPEND PO_BUILD ${PO_FILE}.po)
-	ENDIF (TRANSLATION_${PO_FILE})
-ENDFOREACH (PO_FILE ${PO_FILES})
+	if (TRANSLATION_${PO_FILE})
+		list (APPEND PO_BUILD ${PO_FILE}.po)
 
-GETTEXT_PROCESS_PO_FILES ("" ALL INSTALL_DESTINATION ${LOCALEDIR} PO_FILES ${PO_BUILD})
+		install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${PO_FILE}.gmo
+			DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${PO_FILE}/LC_MESSAGES/
+			RENAME amule.mo
+		)
+	endif()
+endforeach()
+
+gettext_process_po_files ("" ALL PO_FILES ${PO_BUILD})