Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #20 from saa/master

Add %% -*- coding: latin-1 -*- for compile on erlang >17.0
  • Loading branch information...
commit cb4654d7a0105b95fbbd915ad4090f805b071d61 2 parents 470443a + 532e8cd
Torbjörn Törnkvist authored March 18, 2014
61  src/gettext.erl
... ...
@@ -1,3 +1,4 @@
  1
+%% -*- coding: latin-1 -*-
1 2
 %% -------------------------------------------------------------------------
2 3
 %% Permission is hereby granted, free of charge, to any person obtaining a
3 4
 %% copy of this software and associated documentation files (the
@@ -6,10 +7,10 @@
6 7
 %% distribute, sublicense, and/or sell copies of the Software, and to permit
7 8
 %% persons to whom the Software is furnished to do so, subject to the
8 9
 %% following conditions:
9  
-%% 
  10
+%%
10 11
 %% The above copyright notice and this permission notice shall be included
11 12
 %% in all copies or substantial portions of the Software.
12  
-%% 
  13
+%%
13 14
 %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 15
 %% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 16
 %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
@@ -25,8 +26,8 @@
25 26
 -module(gettext).
26 27
 
27 28
 -export([parse_po/1, lc2lang/1,
28  
-	 parse_po_bin/1, all_lang/0, 
29  
-	 key2str/1, key2str/2, key2str/3, 
  29
+	 parse_po_bin/1, all_lang/0,
  30
+	 key2str/1, key2str/2, key2str/3,
30 31
 	 all_lcs/0, all_lcs/1,
31 32
 	 reload_custom_lang/1, reload_custom_lang/2,
32 33
 	 unload_custom_lang/1, unload_custom_lang/2,
@@ -34,14 +35,14 @@
34 35
 	 gettext_dir/0, gettext_dir/1,
35 36
 	 change_gettext_dir/1, change_gettext_dir/2,
36 37
 	 default_lang/0, default_lang/1,
37  
-	 store_pofile/2, store_pofile/3, 
  38
+	 store_pofile/2, store_pofile/3,
38 39
 	 lang2cset/1, lang2cset/2]).
39 40
 
40 41
 -export([get_app_key/2
41 42
          , mk_polish_style_header/1
42 43
          , fixed_last_translator/0
43 44
          , fixed_revision_date/0
44  
-         , create_date/0 
  45
+         , create_date/0
45 46
          , charset/0
46 47
          , team/0
47 48
          , org_name/0
@@ -62,21 +63,21 @@
62 63
 %%% put the language to be used in the process dictionary.
63 64
 
64 65
 %% @doc Get the translation string for a key using the current language.
65  
-%% 
  66
+%%
66 67
 %% This is usually not called directly, but via the `?TXT(Key)' macro.
67 68
 
68  
-key2str(Key) -> 
  69
+key2str(Key) ->
69 70
     key2str(Key, get(gettext_language)).
70 71
 
71 72
 %% @doc Get the translation string for a key and a specific language
72 73
 %% and/or using a named gettext server. If no server is specified, the
73 74
 %% default server is used. If no language is specified, the current
74 75
 %% language is used.
75  
-%% 
  76
+%%
76 77
 %% This is usually not called directly, but via the `?TXT2(Key,Lang)'
77 78
 %% macro.
78 79
 
79  
-key2str(Key, Lang) when is_list(Key) -> 
  80
+key2str(Key, Lang) when is_list(Key) ->
80 81
     key2str(?DEFAULT_SERVER, Key, Lang);
81 82
 key2str(Server, Key) when is_atom(Server) ->
82 83
     key2str(Server, Key, get(gettext_language)).
@@ -84,7 +85,7 @@ key2str(Server, Key) when is_atom(Server) ->
84 85
 %% @doc Get the translation string for a key and a specific language
85 86
 %% using the named gettext server.
86 87
 
87  
-key2str(_Server, Key, "a") -> 
  88
+key2str(_Server, Key, "a") ->
88 89
     a_language(Key);
89 90
 key2str(Server, Key, Lang) ->
90 91
     gen_server:call(Server, {key2str, Key, Lang}, infinity).
@@ -122,8 +123,8 @@ all_lcs(Server) ->
122 123
 %% @doc Recreates the database file from scratch.
123 124
 
124 125
 recreate_db() ->
125  
-    recreate_db(?DEFAULT_SERVER). 
126  
-   
  126
+    recreate_db(?DEFAULT_SERVER).
  127
+
127 128
 recreate_db(Server) ->
128 129
     gen_server:call(Server, recreate_db, infinity).
129 130
 
@@ -226,7 +227,7 @@ get_po_string([$\t|T]) -> get_po_string(T);
226 227
 get_po_string([$"|T])  -> header_info(eat_string(T)).       %"make emacs happy
227 228
 
228 229
 %%% only header-info has empty po-string !
229  
-header_info({"",R}) -> {?GETTEXT_HEADER_INFO, R};  
  230
+header_info({"",R}) -> {?GETTEXT_HEADER_INFO, R};
230 231
 header_info(X)      -> X.
231 232
 
232 233
 eat_string(S) ->
@@ -256,31 +257,31 @@ to_list(L) when is_list(L)    -> L.
256 257
 %%% Language Codes
257 258
 %%% --------------------------------------------------------------------
258 259
 
259  
-lc2lang(LC) -> 
  260
+lc2lang(LC) ->
260 261
     case gettext_iso639:lc3lang(LC) of
261 262
 	""   -> gettext_iso639:lc2lang(LC);  % backward compatible
262 263
 	Lang -> Lang
263 264
     end.
264  
-    
  265
+
265 266
 
266 267
 all_lang() -> gettext_iso639:all3lang().
267 268
 
268 269
 
269 270
 %%% -------------------------------------------------------------------
270  
-%%% Function name: 
  271
+%%% Function name:
271 272
 %%% a_language
272 273
 %%% Function purpose:
273 274
 %%% A special function to convert all strings in a po-file to a's Used
274 275
 %%% to check what text has been textified and what hasn't been
275 276
 %%% textified. Also converts numbers to b's instead.  The intended
276 277
 %%% language ISO to be used is ISO/IEC 8859-1 (Latin-1)
277  
-%%% The check in the last clause: the intervals 
  278
+%%% The check in the last clause: the intervals
278 279
 %%% 1. Hd > 64 andalso Hd < 91   = Uppercase Alpha numerical characters
279 280
 %%% 2. Hd > 96 andalso Hd < 123  = Lowercase Alpha numerical characters
280 281
 %%% 3. Hd > 191 andalso Hd < 256 = Special language characters (Ex. ï)
281 282
 %%% 3. Hd > 47 andalso Hd < 58   = Numbers
282  
-%%% sees to that only Alphanumerical characters is replaced, to keep 
283  
-%%% special characters, so that the context will remain to a higher 
  283
+%%% sees to that only Alphanumerical characters is replaced, to keep
  284
+%%% special characters, so that the context will remain to a higher
284 285
 %%% degree.
285 286
 %%% -------------------------------------------------------------------
286 287
 a_language(Key) ->
@@ -294,7 +295,7 @@ a_language([$<|_Tl] = Key, Acc) ->
294 295
 a_language([$\s = Hd |Tl], Acc) ->
295 296
     a_language(Tl, [Hd|Acc]);
296 297
 a_language([$~ = Hd |Tl], Acc) ->
297  
-    [Hd2|Tl2] = Tl, 
  298
+    [Hd2|Tl2] = Tl,
298 299
     a_language(Tl2, [Hd2, Hd |Acc]);
299 300
 a_language([$$|Tl], Acc) ->
300 301
     {RestKey, DollarFormat} = search_for(Tl, [], $$),
@@ -302,7 +303,7 @@ a_language([$$|Tl], Acc) ->
302 303
 a_language([Hd|Tl], Acc) ->
303 304
     Char = if
304 305
 	    (Hd > 64 andalso Hd < 91) orelse  % See function spec above (1.)
305  
-	    (Hd > 96 andalso Hd < 123) orelse % See function spec above (2.) 
  306
+	    (Hd > 96 andalso Hd < 123) orelse % See function spec above (2.)
306 307
 	    (Hd > 191 andalso Hd < 256) ->    % See function spec above (3.)
307 308
 		$a;
308 309
 	    Hd > 47 andalso Hd < 58 ->
@@ -313,11 +314,11 @@ a_language([Hd|Tl], Acc) ->
313 314
     a_language(Tl, [Char |Acc]).
314 315
 
315 316
 %%% -------------------------------------------------------------------
316  
-%%% Function name: 
  317
+%%% Function name:
317 318
 %%% search_for
318 319
 %%% Function purpose:
319  
-%%% A function, used as a help-function to a_language. It's mostly 
320  
-%%% to be used to look for html so that links and html formatting 
  320
+%%% A function, used as a help-function to a_language. It's mostly
  321
+%%% to be used to look for html so that links and html formatting
321 322
 %%% doesn't break when trying to converting strings to a's. The html are
322 323
 %%% detected by matching for < and > and passes that text-chunk on to
323 324
 %%% a_language and then a_language does it's magic and continues
@@ -359,16 +360,16 @@ create_date() ->
359 360
 
360 361
 charset() ->
361 362
     get_app_key(charset, "iso-8859-1").
362  
-    
  363
+
363 364
 team() ->
364 365
     get_app_key(team, "Team <info@team.com>").
365  
-    
  366
+
366 367
 org_name() ->
367 368
     get_app_key(team, "Organization").
368  
-    
  369
+
369 370
 copyright() ->
370 371
     get_app_key(copyright, "YYYY Organization").
371  
-    
  372
+
372 373
 callback_mod() ->
373 374
     get_app_key(callback_mod, gettext_server).
374 375
 
@@ -386,7 +387,7 @@ mk_polish_style_header(LC) ->
386 387
       charset()
387 388
      ).
388 389
 
389  
-mk_polish_style_header(Header, CopyRight, CreateDate, RevDate, 
  390
+mk_polish_style_header(Header, CopyRight, CreateDate, RevDate,
390 391
                        LastTranslator, Team, Charset) ->
391 392
     "# "++Header++"\n"
392 393
         "# Copyright (C) "++CopyRight++"\n"
11  src/gettext_app.erl
... ...
@@ -1,3 +1,4 @@
  1
+%% -*- coding: latin-1 -*-
1 2
 %% -------------------------------------------------------------------------
2 3
 %% Permission is hereby granted, free of charge, to any person obtaining a
3 4
 %% copy of this software and associated documentation files (the
@@ -6,10 +7,10 @@
6 7
 %% distribute, sublicense, and/or sell copies of the Software, and to permit
7 8
 %% persons to whom the Software is furnished to do so, subject to the
8 9
 %% following conditions:
9  
-%% 
  10
+%%
10 11
 %% The above copyright notice and this permission notice shall be included
11 12
 %% in all copies or substantial portions of the Software.
12  
-%% 
  13
+%%
13 14
 %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 15
 %% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 16
 %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
@@ -38,11 +39,11 @@
38 39
 %% Func: start/2
39 40
 %% Returns: {ok, Pid}        |
40 41
 %%          {ok, Pid, State} |
41  
-%%          {error, Reason}   
  42
+%%          {error, Reason}
42 43
 %%----------------------------------------------------------------------
43 44
 start(_Type, _StartArgs) ->
44 45
     case gettext_sup:start_link() of
45  
-	{ok, Pid} -> 
  46
+	{ok, Pid} ->
46 47
 	    {ok, Pid};
47 48
 	Error ->
48 49
 	    Error
@@ -50,7 +51,7 @@ start(_Type, _StartArgs) ->
50 51
 
51 52
 %%----------------------------------------------------------------------
52 53
 %% Func: stop/1
53  
-%% Returns: any 
  54
+%% Returns: any
54 55
 %%----------------------------------------------------------------------
55 56
 stop(_State) ->
56 57
     ok.
29  src/gettext_compile.erl
... ...
@@ -1,3 +1,4 @@
  1
+%% -*- coding: latin-1 -*-
1 2
 %% -------------------------------------------------------------------------
2 3
 %% Permission is hereby granted, free of charge, to any person obtaining a
3 4
 %% copy of this software and associated documentation files (the
@@ -6,10 +7,10 @@
6 7
 %% distribute, sublicense, and/or sell copies of the Software, and to permit
7 8
 %% persons to whom the Software is furnished to do so, subject to the
8 9
 %% following conditions:
9  
-%% 
  10
+%%
10 11
 %% The above copyright notice and this permission notice shall be included
11 12
 %% in all copies or substantial portions of the Software.
12  
-%% 
  13
+%%
13 14
 %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 15
 %% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 16
 %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
@@ -91,12 +92,12 @@ escape_chars(Str) ->
91 92
     F = fun($", Acc)  -> [$\\,$"|Acc];
92 93
            ($\\, Acc) -> [$\\,$\\|Acc];
93 94
            ($\n, Acc) -> [$\\,$n|Acc];
94  
-	   (C, Acc)   -> [C|Acc] 
  95
+	   (C, Acc)   -> [C|Acc]
95 96
 	end,
96 97
     lists:foldr(F, [], Str).
97 98
 
98 99
 
99  
-%%% Split the string into substrings, 
  100
+%%% Split the string into substrings,
100 101
 %%% aligned around a specific column.
101 102
 get_line(Str) ->
102 103
     get_line(Str, ?SEP, 1, ?ENDCOL, []).
@@ -137,7 +138,7 @@ find_end([H|T], Sep, N, Pivot, Acc) ->
137 138
     find_end(T, Sep, N+1, Pivot, [H|Acc]);
138 139
 find_end([], _Sep, _N, _Pivot, Acc) ->
139 140
     {true, Acc, []}.
140  
-    
  141
+
141 142
 reverse_tape(Acc, Str) ->
142 143
     reverse_tape(Acc, Str, ?SEP).
143 144
 
@@ -157,7 +158,7 @@ split_string([H|T], End, N, Acc) when N < End ->
157 158
     split_string(T, End, N+1, [H|Acc]);
158 159
 split_string([], _End, _N, Acc) ->
159 160
     {lists:reverse(Acc), []}.
160  
-    
  161
+
161 162
 %%%fmt_fileinfo(Finfo) ->
162 163
 %%%    F = fun({Fname,LineNo}, Acc) ->
163 164
 %%%		Fname ++ ":" ++ to_list(LineNo) ++ [$\s|Acc]
@@ -194,13 +195,13 @@ mk_header(true  = _UseOrigHeader, _LC) ->
194 195
         "\"Content-Type: text/plain; charset=iso-8859-1\\n\"\n"
195 196
         "\"Content-Transfer-Encoding: 8bit\\n\"\n".
196 197
 
197  
- 
  198
+
198 199
 %%% --------------------------------------------------------------------
199 200
 %%% NB: We assume that the surrounding code does some preparations:
200 201
 %%%
201 202
 %%%   1. The compiler is called with the 'gettext' flag.
202 203
 %%%
203  
-%%%   2. The file priv/lang/epot.dets is 
  204
+%%%   2. The file priv/lang/epot.dets is
204 205
 %%%      removed before the first erlang/yaws file is processed.
205 206
 %%%      (entrys are appended to the file)
206 207
 %%% --------------------------------------------------------------------
@@ -212,7 +213,7 @@ parse_transform(Form,Opts) ->
212 213
 	    {Gettext_App_Name, GtxtDir, _} = get_env(),
213 214
 	    open_epot_file(Gettext_App_Name, GtxtDir),
214 215
 	    ?debug( "--- Opts --- ~p~n",[Opts]),
215  
-	    ?debug("--- Env --- isd_type=~p , gettext_dir=~p~n", 
  216
+	    ?debug("--- Env --- isd_type=~p , gettext_dir=~p~n",
216 217
 		   [Gettext_App_Name,GtxtDir]),
217 218
             try pt(Form, Opts) after close_epot_file() end,
218 219
 	    Form;
@@ -222,13 +223,13 @@ parse_transform(Form,Opts) ->
222 223
 
223 224
 get_env(Key) ->
224 225
     case application:get_env(gettext, Key) of
225  
-        undefined -> 
  226
+        undefined ->
226 227
             case Key of
227 228
                 path -> ".";
228 229
                 lang -> ?DEFAULT_LANG;
229 230
                 name -> "tmp"
230 231
             end;
231  
-        {ok, Value} -> 
  232
+        {ok, Value} ->
232 233
             Value
233 234
     end.
234 235
 
@@ -305,7 +306,7 @@ while(0,T,_,_) ->
305 306
 
306 307
 
307 308
 dump("", _) -> ok;
308  
-dump(Str,L) -> 
  309
+dump(Str,L) ->
309 310
     Fname = get(fname),
310 311
     Finfo = get_file_info(Str),
311 312
     dets:insert(?EPOT_TABLE, {Str, [{Fname,L}|Finfo]}).
@@ -345,7 +346,3 @@ to_list(A) when is_atom(A)    -> atom_to_list(A);
345 346
 to_list(I) when is_integer(I) -> integer_to_list(I);
346 347
 to_list(B) when is_binary(B)  -> binary_to_list(B);
347 348
 to_list(L) when is_list(L)    -> L.
348  
-
349  
-
350  
-
351  
-
30  src/gettext_format.erl
... ...
@@ -1,3 +1,4 @@
  1
+%% -*- coding: latin-1 -*-
1 2
 %% -------------------------------------------------------------------------
2 3
 %% Permission is hereby granted, free of charge, to any person obtaining a
3 4
 %% copy of this software and associated documentation files (the
@@ -6,10 +7,10 @@
6 7
 %% distribute, sublicense, and/or sell copies of the Software, and to permit
7 8
 %% persons to whom the Software is furnished to do so, subject to the
8 9
 %% following conditions:
9  
-%% 
  10
+%%
10 11
 %% The above copyright notice and this permission notice shall be included
11 12
 %% in all copies or substantial portions of the Software.
12  
-%% 
  13
+%%
13 14
 %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 15
 %% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 16
 %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
@@ -30,30 +31,30 @@
30 31
 -export ([
31 32
 	  stxt/2,
32 33
 	  get_vars_in_format_str/1
33  
-	 ]).  
  34
+	 ]).
34 35
 
35 36
 %%=============================================================================
36 37
 %% External functions
37 38
 %%=============================================================================
38 39
 
39 40
 %% ----------------------------------------------------------------------------
40  
-%% @spec stxt(FormatStr::string(), 
  41
+%% @spec stxt(FormatStr::string(),
41 42
 %%            Args::[{Key::atom(),SubVal::string()}]) -> string()
42 43
 %% @doc  This function is similar to io_lib:format/2 but allows FormatStr to use
43 44
 %%       Args in any order, any number of times or not at all.
44 45
 %%       This is needed for translators of po files to be able to write
45  
-%%       translations with a natural scentence structure. 
  46
+%%       translations with a natural scentence structure.
46 47
 %%
47  
-%%       FormatStr: can contain $arg_name$ markers where arg_name must be one 
48  
-%%       of the Key entries in Args to substitute (when converted to a atom). 
  48
+%%       FormatStr: can contain $arg_name$ markers where arg_name must be one
  49
+%%       of the Key entries in Args to substitute (when converted to a atom).
49 50
 %%       Key can be any atom not containing $.
50 51
 %%
51 52
 %%       FormatStr is processed as shown below (premature FormatStr end states
52 53
 %%       and "missing char" edges aren't shown):
53 54
 %%
54  
-%%```          $            !$             $           
  55
+%%```          $            !$             $
55 56
 %%     ->(0) --------> (2) --------> (3) -------> (4)
56  
-%%    | ^  \            \           ^  \           |  
  57
+%%    | ^  \            \           ^  \           |
57 58
 %%    | \__/             \ $        \__/ !$        |
58 59
 %%    |     !$            v                        |
59 60
 %%    |                   (1)                      |
@@ -62,7 +63,7 @@
62 63
 %%    0  : start state
63 64
 %%    1  : quoted $ found
64 65
 %%    2/3: (start) accumulating tag name
65  
-%%    4  : look up tag in Args  
  66
+%%    4  : look up tag in Args
66 67
 %%'''
67 68
 %%      Note that Key/arg_name should be chosen to be helpfull to the translator
68 69
 %%      who will usually only have acess to FormatStr shown as the MsgId in the
@@ -70,8 +71,8 @@
70 71
 %% @end------------------------------------------------------------------------
71 72
 stxt(Str, Args) ->
72 73
     try stxt0(Str, Args)
73  
-    catch throw:Reason -> throw({reason, Reason, 
74  
-				 input_str, Str, 
  74
+    catch throw:Reason -> throw({reason, Reason,
  75
+				 input_str, Str,
75 76
 				 input_args, Args})
76 77
     end.
77 78
 
@@ -124,7 +125,7 @@ get_arg(Key, Args) ->
124 125
 %%       properly
125 126
 get_vars_in_format_str(FormatStr) ->
126 127
     try get_vars(FormatStr, [])
127  
-    catch throw:Reason -> throw({reason, Reason, 
  128
+    catch throw:Reason -> throw({reason, Reason,
128 129
 				 input_str, FormatStr})
129 130
     end.
130 131
 
@@ -154,6 +155,3 @@ get_vars3([C|R], Vars, Acc) ->
154 155
 %% unexpected end of FormatStr
155 156
 get_vars3([], _, _) ->
156 157
     throw("$...$ tag is missing ending $").
157  
-
158  
-
159  
-
6  src/gettext_iso639.erl
... ...
@@ -1,3 +1,4 @@
  1
+%% -*- coding: latin-1 -*-
1 2
 %% -------------------------------------------------------------------------
2 3
 %% Permission is hereby granted, free of charge, to any person obtaining a
3 4
 %% copy of this software and associated documentation files (the
@@ -6,10 +7,10 @@
6 7
 %% distribute, sublicense, and/or sell copies of the Software, and to permit
7 8
 %% persons to whom the Software is furnished to do so, subject to the
8 9
 %% following conditions:
9  
-%% 
  10
+%%
10 11
 %% The above copyright notice and this permission notice shall be included
11 12
 %% in all copies or substantial portions of the Software.
12  
-%% 
  13
+%%
13 14
 %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 15
 %% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 16
 %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
@@ -1185,4 +1186,3 @@ all2lang() ->
1185 1186
      {"za", "Zhuang"},
1186 1187
      {"zh", "Chinese"},
1187 1188
      {"zu", "Zulu"}].
1188  
-
41  src/gettext_server.erl
... ...
@@ -1,3 +1,4 @@
  1
+%% -*- coding: latin-1 -*-
1 2
 %% -------------------------------------------------------------------------
2 3
 %% Permission is hereby granted, free of charge, to any person obtaining a
3 4
 %% copy of this software and associated documentation files (the
@@ -6,10 +7,10 @@
6 7
 %% distribute, sublicense, and/or sell copies of the Software, and to permit
7 8
 %% persons to whom the Software is furnished to do so, subject to the
8 9
 %% following conditions:
9  
-%% 
  10
+%%
10 11
 %% The above copyright notice and this permission notice shall be included
11 12
 %% in all copies or substantial portions of the Software.
12  
-%% 
  13
+%%
13 14
 %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 15
 %% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 16
 %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
@@ -40,7 +41,7 @@
40 41
 -export([gettext_dir/0, gettext_def_lang/0]).
41 42
 
42 43
 %% gen_server callbacks
43  
--export([init/1, handle_call/3, handle_cast/2, handle_info/2, 
  44
+-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
44 45
 	 terminate/2, code_change/3]).
45 46
 
46 47
 -include("gettext_internal.hrl").
@@ -58,7 +59,7 @@
58 59
           def_lang,          % default language
59 60
 	  gettext_dir,       % Dir where all the data are stored
60 61
 	  table_name         % autogenerated from server name
61  
-	 }).                 
  62
+	 }).
62 63
 
63 64
 %%%
64 65
 %%% Hold info about the languages stored.
@@ -81,7 +82,7 @@ gettext_dir() ->
81 82
 
82 83
 gettext_def_lang() ->
83 84
     ?DEFAULT_LANG.
84  
-    
  85
+
85 86
 
86 87
 %%--------------------------------------------------------------------
87 88
 %% Function: start_link/0
@@ -280,7 +281,7 @@ create_db(TableName, GettextDir) ->
280 281
     create_db(TableName, GettextDir, db_filename(TableName, GettextDir)).
281 282
 
282 283
 create_db(TableName, GettextDir, Fname) ->
283  
-    filelib:ensure_dir(Fname), 
  284
+    filelib:ensure_dir(Fname),
284 285
     init_db_table(TableName, GettextDir, Fname).
285 286
 
286 287
 recreate_db(TableName, GettextDir) ->
@@ -304,15 +305,15 @@ unload_custom_lang(TableName, GettextDir, Lang) ->
304 305
 reload_custom_lang(TableName, GettextDir, Lang) ->
305 306
     dets:match_delete(TableName, ?ENTRY(Lang,'_','_')),
306 307
     Dir = filename:join([GettextDir, ?LANG_DIR, ?CUSTOM_DIR, Lang]),
307  
-    Fname = filename:join([Dir, ?POFILE]), 
  308
+    Fname = filename:join([Dir, ?POFILE]),
308 309
     insert_po_file(TableName, Lang, Fname),
309 310
     recreate_ets_table(TableName),
310 311
     ok.
311 312
 
312 313
 store_pofile(TableName, Lang, File, GettextDir, Cache) ->
313 314
     Dir = filename:join([GettextDir, ?LANG_DIR, ?CUSTOM_DIR, Lang]),
314  
-    Fname = filename:join([Dir, ?POFILE]), 
315  
-    filelib:ensure_dir(Fname), 
  315
+    Fname = filename:join([Dir, ?POFILE]),
  316
+    filelib:ensure_dir(Fname),
316 317
     case file:write_file(Fname, File) of
317 318
 	ok ->
318 319
 	    case lists:keymember(Lang, #cache.language, Cache) of
@@ -361,8 +362,8 @@ init_db_table(TableName, GettextDir, TableFile) ->
361 362
 	false ->
362 363
 	    create_and_populate(TableName, GettextDir, TableFile);
363 364
 	true ->
364  
-	    %% If the dets file is broken, dets may not be able to repair it 
365  
-	    %% itself (it may be only half-written). So check and recreate 
  365
+	    %% If the dets file is broken, dets may not be able to repair it
  366
+	    %% itself (it may be only half-written). So check and recreate
366 367
 	    %% if needed instead.
367 368
 	    case open_dets_file(TableName, TableFile) of
368 369
 		ok -> create_cache(TableName);
@@ -392,7 +393,7 @@ create_and_populate(TableName, GettextDir, TableFile) ->
392 393
 			     [{file, TableFile},
393 394
 			      %% creating on disk, esp w auto_save,
394 395
 			      %% takes "forever" on flash disk
395  
-			      {ram_file, true}]), 
  396
+			      {ram_file, true}]),
396 397
     L = populate_db(TableName, GettextDir),
397 398
     dets:close(TableName),    % flush to disk
398 399
     {ok, _} = dets:open_file(TableName, [{file, TableFile}]),
@@ -408,16 +409,16 @@ recreate_ets_table(TableName) ->
408 409
 
409 410
 %% To speed up the read access 10-100 times !!
410 411
 create_and_populate_ets_table(TableName) ->
411  
-    try 
  412
+    try
412 413
         E = ets:new(?MODULE, [set, private]),
413 414
 	put(ets_table, E),
414 415
         ets:from_dets(E, TableName),
415 416
         true
416  
-    catch 
  417
+    catch
417 418
             _:_ -> false
418 419
     end.
419  
-            
420  
-        
  420
+
  421
+
421 422
 
422 423
 open_dets_file(Tname, Fname) ->
423 424
     Opts = [{file, Fname}, {repair, false}],
@@ -437,7 +438,7 @@ open_dets_file(Tname, Fname) ->
437 438
 %%%     able to 'shadow' the the same predefined language.
438 439
 %%%
439 440
 populate_db(TableName, GettextDir) ->
440  
-    L = insert_predefined(TableName, GettextDir, []), 
  441
+    L = insert_predefined(TableName, GettextDir, []),
441 442
     insert_custom(TableName, GettextDir, L).
442 443
 
443 444
 insert_predefined(TableName, GettextDir, L) ->
@@ -500,15 +501,15 @@ lookup(TableName, Lang, DefaultLang, Key) ->
500 501
     catch
501 502
         _:_ ->
502 503
 	    case dets:lookup(TableName, ?KEY(Lang, Key)) of
503  
-		[]          -> Key;  
  504
+		[]          -> Key;
504 505
 		[?ENTRY(_,_,Str)|_] -> Str
505 506
 	    end
506 507
     end.
507  
-    
  508
+
508 509
 
509 510
 delete_lc(TableName, LC) ->
510 511
     dets:match_delete(TableName, ?ENTRY(LC, '_', '_')).
511  
-    
  512
+
512 513
 
513 514
 all_lcs_dets(TableName) ->
514 515
     L = dets:match(TableName, ?ENTRY('$1', ?GETTEXT_HEADER_INFO, '_')),
7  src/gettext_sup.erl
... ...
@@ -1,3 +1,4 @@
  1
+%% -*- coding: latin-1 -*-
1 2
 %% -------------------------------------------------------------------------
2 3
 %% Permission is hereby granted, free of charge, to any person obtaining a
3 4
 %% copy of this software and associated documentation files (the
@@ -6,10 +7,10 @@
6 7
 %% distribute, sublicense, and/or sell copies of the Software, and to permit
7 8
 %% persons to whom the Software is furnished to do so, subject to the
8 9
 %% following conditions:
9  
-%% 
  10
+%%
10 11
 %% The above copyright notice and this permission notice shall be included
11 12
 %% in all copies or substantial portions of the Software.
12  
-%% 
  13
+%%
13 14
 %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 15
 %% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 16
 %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
@@ -50,7 +51,7 @@ start_link(Options) ->
50 51
 %% Func: init/1
51 52
 %% Returns: {ok,  {SupFlags,  [ChildSpec]}} |
52 53
 %%          ignore                          |
53  
-%%          {error, Reason}   
  54
+%%          {error, Reason}
54 55
 %%----------------------------------------------------------------------
55 56
 init([]) ->
56 57
     init([{gettext:callback_mod(),application:get_all_env()}]);  % just a default that should always work
93  src/gettext_validate.erl
... ...
@@ -1,3 +1,4 @@
  1
+%% -*- coding: latin-1 -*-
1 2
 %% -------------------------------------------------------------------------
2 3
 %% Permission is hereby granted, free of charge, to any person obtaining a
3 4
 %% copy of this software and associated documentation files (the
@@ -6,10 +7,10 @@
6 7
 %% distribute, sublicense, and/or sell copies of the Software, and to permit
7 8
 %% persons to whom the Software is furnished to do so, subject to the
8 9
 %% following conditions:
9  
-%% 
  10
+%%
10 11
 %% The above copyright notice and this permission notice shall be included
11 12
 %% in all copies or substantial portions of the Software.
12  
-%% 
  13
+%%
13 14
 %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 15
 %% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 16
 %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
@@ -44,7 +45,7 @@
44 45
 %% Returns a short text used as heading when listing errors/warnings for
45 46
 %% this checker.
46 47
 %%
47  
-%% ```check({OriginalFormatStr::string(), TranslatedFormatStr::string()}, 
  48
+%% ```check({OriginalFormatStr::string(), TranslatedFormatStr::string()},
48 49
 %%          Ignores, Acc::[acc()]) -> UpdatedAcc::[acc()]'''
49 50
 %% Returns an updated accumulator `UpdatedAcc' after checking
50 51
 %% `OriginalFormatStr' against `TranslatedFormatStr'. One or more entries
@@ -55,8 +56,8 @@
55 56
 %% broken - ignore files could otherwise hide broken checks.
56 57
 %%
57 58
 %% Each acc() must be of the format:
58  
-%%```{alert_level(), 
59  
-%%    ErrorMsg::string(), 
  59
+%%```{alert_level(),
  60
+%%    ErrorMsg::string(),
60 61
 %%    Pairs::{Name::atom(), Info::term()} ....}'''
61 62
 %% where `alert_level()' is either `` 'ERROR' '', indicating an error that
62 63
 %% may cause a crash (e.g., in STXT) or generate invalid output, or ``
@@ -68,7 +69,7 @@
68 69
 
69 70
 
70 71
 %% @type output() = [{{heading,          string()},
71  
-%%                    {ignore_type,      atom()}, 
  72
+%%                    {ignore_type,      atom()},
72 73
 %%		      {po_file_path,     string()},
73 74
 %%		      {ignore_file_path, string()},
74 75
 %% 		      CheckRes::[acc()]
@@ -94,7 +95,7 @@
94 95
 	  %% this may be useful when defining your own opts, e.g. when adding
95 96
 	  %% new checks
96 97
 	  default_opts/0
97  
-	 ]).  
  98
+	 ]).
98 99
 
99 100
 
100 101
 %%=============================================================================
@@ -108,7 +109,7 @@
108 109
 validate_q(PoFilePath) ->
109 110
     validate(PoFilePath, "", default_opts()).
110 111
 
111  
-%% no opts 
  112
+%% no opts
112 113
 validate_q(PoFilePath, IgnoreFilePath) ->
113 114
     validate(PoFilePath, IgnoreFilePath, default_opts()).
114 115
 
@@ -119,27 +120,27 @@ validate_q(PoFilePath, IgnoreFilePath) ->
119 120
 validate_qf(PoFilePath, SaveFile) ->
120 121
     validate(PoFilePath, "", default_opts() ++ [{to_file, SaveFile}]).
121 122
 
122  
-%% no opts 
  123
+%% no opts
123 124
 validate_qf(PoFilePath, IgnoreFilePath, SaveFile) ->
124  
-    validate(PoFilePath, IgnoreFilePath, 
  125
+    validate(PoFilePath, IgnoreFilePath,
125 126
 	     default_opts() ++ [{to_file, SaveFile}]).
126 127
 
127 128
 
128 129
 %% ----------------------------------------------------------------------------
129 130
 %% @spec validate(PoFilePath::string(), IgnoreFilePath::[]|string(),
130 131
 %%                Opts::[{Key, Val}]) -> ok | output()
131  
-%% @doc  Takes a valid (parsable) po file and checks that there are no 
  132
+%% @doc  Takes a valid (parsable) po file and checks that there are no
132 133
 %%       inconsistencies between the msgid and msgstr texts.
133  
-%% 
  134
+%%
134 135
 %%       The function prints a result listing.
135  
-%% 
  136
+%%
136 137
 %%       `PoFilePath'     - the po file check
137 138
 %%
138  
-%%       `IgnoreFilePath' - a optional file that can be used to specify 
  139
+%%       `IgnoreFilePath' - a optional file that can be used to specify
139 140
 %%                          {CheckType, MsgId, MsgStr} combinations that should
140  
-%%                          not be reported as a errors/warnings - false 
  141
+%%                          not be reported as a errors/warnings - false
141 142
 %%                          positives.
142  
-%%                          Each (language) po file should usualy have one such 
  143
+%%                          Each (language) po file should usualy have one such
143 144
 %%                          ignore file.
144 145
 %%
145 146
 %%       `Opts:'
@@ -153,23 +154,23 @@ validate_qf(PoFilePath, IgnoreFilePath, SaveFile) ->
153 154
 %%'''
154 155
 %% @end------------------------------------------------------------------------
155 156
 validate(PoFilePath, IgnoreFilePath, Opts) ->
156  
-    Terms = 
  157
+    Terms =
157 158
 	case IgnoreFilePath of
158 159
 	    "" -> [];
159 160
 	    _  -> case file:consult(IgnoreFilePath) of
160 161
 		      {ok, Terms0}     -> Terms0;
161  
-		      {error, Reason0} -> 
  162
+		      {error, Reason0} ->
162 163
 			  throw({no_ignore_file_or_malformed_file, Reason0})
163 164
 		  end
164 165
 	end,
165 166
     Ignores = ets:new(dummy, [set,private,{keypos,1}]),
166 167
 
167 168
     %% catch exceptions so that ets table is always cleaned up
168  
-    Res = 
  169
+    Res =
169 170
 	try
170 171
 	    %% fill ets table with ignore data for fast lookup
171 172
 	    lists:foreach(
172  
-	      fun(E) -> 
  173
+	      fun(E) ->
173 174
 		      case is_valid_ignore_entry(E) of
174 175
 			  true  -> ets:insert(Ignores, {E});
175 176
 			  false -> throw({invalid_ignore_file_entry, E})
@@ -177,14 +178,14 @@ validate(PoFilePath, IgnoreFilePath, Opts) ->
177 178
 	      end, Terms),
178 179
 
179 180
 	    %% get file and discard non-text meta data header
180  
-	    [{header_info, _} | Trans] = 
  181
+	    [{header_info, _} | Trans] =
181 182
 	    try gettext:parse_po(PoFilePath)
182 183
 	    catch _:_ -> throw(po_file_not_found_or_parsing_failed)
183 184
 	    end,
184 185
 
185 186
 	    %% assert that there are no msgid duplicates
186 187
 	    throw_on_duplicates(Trans),
187  
-	    
  188
+
188 189
 	    Callbacks = look_up(checkers, Opts),
189 190
 	    CheckResults = run_checks(Ignores, Trans, Callbacks),
190 191
 	    EndUser = case look_up(end_user, Opts) of
@@ -193,7 +194,7 @@ validate(PoFilePath, IgnoreFilePath, Opts) ->
193 194
 		      end,
194 195
 	    case EndUser of
195 196
 		human ->
196  
-		    ResultText = format_results(PoFilePath, CheckResults, 
  197
+		    ResultText = format_results(PoFilePath, CheckResults,
197 198
 						Callbacks),
198 199
 		    case look_up(to_file, Opts) of
199 200
 			[] ->
@@ -204,15 +205,15 @@ validate(PoFilePath, IgnoreFilePath, Opts) ->
204 205
 		    ok;
205 206
 		computer ->
206 207
 		    [{{heading, Checker:heading()},
207  
-		      {ignore_type, Checker:ignore_entry_type()}, 
  208
+		      {ignore_type, Checker:ignore_entry_type()},
208 209
 		      {po_file_path, PoFilePath},
209 210
 		      {ignore_file_path, IgnoreFilePath},
210  
-		      CheckRes} 
211  
-		     || {CheckRes, Checker} 
  211
+		      CheckRes}
  212
+		     || {CheckRes, Checker}
212 213
 			    <- lists:zip(CheckResults, Callbacks)]
213 214
 	    end
214  
-	
215  
-	catch _:Reason2 -> 
  215
+
  216
+	catch _:Reason2 ->
216 217
 		throw({validator_crashed, Reason2})
217 218
 	after
218 219
 	    %% all checks done - discard ignore table
@@ -221,7 +222,7 @@ validate(PoFilePath, IgnoreFilePath, Opts) ->
221 222
     Res.
222 223
 
223 224
 %% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
224  
- 
  225
+
225 226
 throw_on_duplicates(MsgidMsgStrL) ->
226 227
     F = fun({MsgId1, _}, {MsgId2, _}) -> MsgId1 < MsgId2 end,
227 228
     SortedPairs = lists:sort(F, MsgidMsgStrL),
@@ -229,7 +230,7 @@ throw_on_duplicates(MsgidMsgStrL) ->
229 230
 	[] -> MsgidMsgStrL;
230 231
 	Dups -> throw({po_file_contained_duplicates, Dups})
231 232
     end.
232  
-	     
  233
+
233 234
 
234 235
 scan_for_duplicate(SortedPairs) ->
235 236
     DupL = scan_for_duplicate(SortedPairs, []),
@@ -244,26 +245,26 @@ scan_for_duplicate([], Acc) ->
244 245
     Acc.
245 246
 
246 247
 
247  
-%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
248  
-%% Check that ignore file looks usable - we don't check the ignore type to 
249  
-%% allow for ignore files used with other sets of checker callback modules 
  248
+%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  249
+%% Check that ignore file looks usable - we don't check the ignore type to
  250
+%% allow for ignore files used with other sets of checker callback modules
250 251
 %% is_list/1 = is_string/1 check
251 252
 %% get IgnoreTypes from ignore_types/1
252 253
 is_valid_ignore_entry(E) ->
253 254
     case E of
254  
-	{Type, MsgId, MsgStr} when is_atom(Type), 
  255
+	{Type, MsgId, MsgStr} when is_atom(Type),
255 256
 				   is_list(MsgId), is_list(MsgStr) ->
256 257
 	    true;
257 258
 	_ ->
258 259
 	    false
259 260
     end.
260 261
 
261  
-%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  262
+%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
262 263
 write_to_file(ResultText, SaveLocation) ->
263 264
     ok = file:write_file(SaveLocation, ResultText).
264 265
 
265 266
 %% return: Val | not_found
266  
-look_up(Key, Opts) -> 
  267
+look_up(Key, Opts) ->
267 268
     case lists:keysearch(Key, 1, Opts) of
268 269
 	{value, {Key, Val}} -> Val;
269 270
 	false -> []
@@ -279,30 +280,30 @@ default_opts() ->
279 280
     ].
280 281
 
281 282
 
282  
-%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  283
+%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
283 284
 run_checks(Ignores, Trans, Callbacks) ->
284 285
     %% Each check runs independetly of all others - no data is retained between
285 286
     %% them this makes it easy to add more tests without breaking stuff.
286 287
 
287 288
     %% get one entry (of [bad()]) for each check
288  
-    [lists:foldl(fun(TxtPair, Acc) -> 
  289
+    [lists:foldl(fun(TxtPair, Acc) ->
289 290
 			 Callback:check(TxtPair, Ignores, Acc)
290 291
 		 end, [], Trans) || Callback <- Callbacks].
291 292
 
292 293
 
293 294
 %% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
294  
-%% return: io_list() 
295  
-format_results(PoFilePath, BadL, Callbacks) 
  295
+%% return: io_list()
  296
+format_results(PoFilePath, BadL, Callbacks)
296 297
   when length(BadL) == length(Callbacks) ->
297 298
     BadEntries = lists:flatten(BadL),
298  
-    
  299
+
299 300
     [
300 301
      io_lib:format("=======================================================\n"
301 302
 		   " Checking: ~s\n"
302 303
 		   " Total - ~s\n"
303  
-		   "=======================================================\n", 
  304
+		   "=======================================================\n",
304 305
 		   [PoFilePath, format_count(BadEntries)])
305  
-    ] ++ 
  306
+    ] ++
306 307
 
307 308
 	[
308 309
 	 io_lib:format(
@@ -310,7 +311,7 @@ format_results(PoFilePath, BadL, Callbacks)
310 311
 	   "~s (~s) \n"
311 312
 	   "ignore type: ~p (use this in the ignore file)\n"
312 313
 	   "-------------------------------------------------------\n"
313  
-	   "~p\n", [Callback:heading(), format_count(Bad), 
  314
+	   "~p\n", [Callback:heading(), format_count(Bad),
314 315
 		    Callback:ignore_entry_type(),
315 316
 		    Bad]) ||
316 317
 	    {Callback, Bad} <- lists:zip(Callbacks, BadL)].
@@ -330,7 +331,7 @@ count(BadEntries) ->
330 331
 		end
331 332
 	end,
332 333
     lists:foldl(F, {0,0}, BadEntries).
333  
-		
  334
+
334 335
 
335 336
 %% ----------------------------------------------------------------------------
336 337
 %% return: bool()
@@ -340,7 +341,7 @@ is_ignore(Tab, {_Type, _OrgText, _TransText} = Key) ->
340 341
 	[{Key}] -> true;
341 342
 	[] -> false
342 343
     end.
343  
-	     
  344
+
344 345
 %% update Acc with Bad only if Key not in Ignores
345 346
 %%
346 347
 %% Ignores - the ets table to check for Key
31  src/gettext_validate_bad_case.erl
... ...
@@ -1,3 +1,4 @@
  1
+%% -*- coding: latin-1 -*-
1 2
 %% -------------------------------------------------------------------------
2 3
 %% Permission is hereby granted, free of charge, to any person obtaining a
3 4
 %% copy of this software and associated documentation files (the
@@ -6,10 +7,10 @@
6 7
 %% distribute, sublicense, and/or sell copies of the Software, and to permit
7 8
 %% persons to whom the Software is furnished to do so, subject to the
8 9
 %% following conditions:
9  
-%% 
  10
+%%
10 11
 %% The above copyright notice and this permission notice shall be included
11 12
 %% in all copies or substantial portions of the Software.
12  
-%% 
  13
+%%
13 14
 %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 15
 %% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 16
 %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
@@ -45,7 +46,7 @@ heading() ->
45 46
 %%       (in case supporting languages) also note that translations will not
46 47
 %%       always start on the same word so they will sometime move a upper case
47 48
 %%       word into a (original text) lower case postion
48  
-%%       
  49
+%%
49 50
 
50 51
 check({OriginalFormatStr, TranslatedFormatStr}, Ignores, Acc) ->
51 52
     %% only do case checks with non-empty strings
@@ -53,35 +54,35 @@ check({OriginalFormatStr, TranslatedFormatStr}, Ignores, Acc) ->
53 54
 	{"", ""} -> Acc;
54 55
 	{"",  _} -> Acc;
55 56
 	{_ , ""} -> Acc;
56  
-	{_ ,  _} -> 
  57
+	{_ ,  _} ->
57 58
 	    %% check if both strings start with the same case
58 59
 	    case case_changed(has_case(hd(OriginalFormatStr)),
59 60
 			      has_case(hd(TranslatedFormatStr))) of
60 61
 		false -> Acc;
61  
-		true -> 
  62
+		true ->
62 63
 		    gettext_validate:do_ignore(
63 64
 		      Ignores,
64  
-		      {bad_case, OriginalFormatStr, 
  65
+		      {bad_case, OriginalFormatStr,
65 66
 		       TranslatedFormatStr},
66 67
 		      {'Warning',
67 68
 		       "Text starts with different case.",
68  
-		       {original,    OriginalFormatStr}, 
  69
+		       {original,    OriginalFormatStr},
69 70
 		       {translation, TranslatedFormatStr}},
70 71
 		      Acc)
71 72
 	    end
72 73
     end.
73 74
 
74 75
 %% return true if case changed i.e. went from upper <-> lower, changing
75  
-%% to/from case_less is not considerd to be a change. 
  76
+%% to/from case_less is not considerd to be a change.
76 77
 case_changed(Case1, Case2) ->
77 78
     case {Case1, Case2} of
78 79
 	{upper, lower} -> true;
79 80
 	{lower, upper} -> true;
80 81
 	_ -> false
81 82
     end.
82  
-	
83 83
 
84  
-%% return: upper | lower | 
  84
+
  85
+%% return: upper | lower |
85 86
 %%         case_less (one variant char e.g. numbers, punctuation ...)
86 87
 %% note  : ï and y with double dots are technicaly a lower case only letters
87 88
 %%         but can in this case checker context be considred to be case less
@@ -90,7 +91,7 @@ has_case(Char) ->
90 91
     [CU] = to_upper([Char]),
91 92
     [CL] = to_lower([Char]),
92 93
     case {CU == Char, CL == Char} of
93  
-	{true,  true}  -> case_less; 
  94
+	{true,  true}  -> case_less;
94 95
 	{true,  false} -> upper;
95 96
 	{false, true}  -> lower
96 97
 	%% {false, false}    should only happen if to_upper/to_lower is broken
@@ -118,11 +119,11 @@ to_upper(C) when C >= $a, C =< $z ->
118 119
     C-($a-$A);
119 120
 %% 224 = a grave, 246 = o umlaut
120 121
 %% 192 = A grave
121  
-to_upper(C) when C >= 224, C =< 246 -> 
  122
+to_upper(C) when C >= 224, C =< 246 ->
122 123
     C-(224 - 192);
123 124
 %% 248 = o slash, 254 = thorn
124 125
 %% 216 = O slash
125  
-to_upper(C) when C >= 248, C =< 254 -> 
  126
+to_upper(C) when C >= 248, C =< 254 ->
126 127
     C-(248 - 216);
127 128
 to_upper(C) ->
128 129
     C.
@@ -134,11 +135,11 @@ to_lower(C) when C >= $A, C =< $Z ->
134 135
     C+($a-$A);
135 136
 %% 192 = A grave, 214 = O umlaut
136 137
 %% 224 = a grave
137  
-to_lower(C) when C >= 192, C =< 214 -> 
  138
+to_lower(C) when C >= 192, C =< 214 ->
138 139
     C+(224 - 192);
139 140
 %% 216 = O slash, 222 = THORN
140 141
 %% 248 = o slash
141  
-to_lower(C) when C >= 216, C =< 222 -> 
  142
+to_lower(C) when C >= 216, C =< 222 ->
142 143
     C+(248 - 216);
143 144
 to_lower(C) ->
144 145
     C.
67  src/gettext_validate_bad_html.erl
... ...
@@ -1,3 +1,4 @@
  1
+%% -*- coding: latin-1 -*-
1 2
 %% -------------------------------------------------------------------------
2 3
 %% Permission is hereby granted, free of charge, to any person obtaining a
3 4
 %% copy of this software and associated documentation files (the
@@ -6,10 +7,10 @@
6 7
 %% distribute, sublicense, and/or sell copies of the Software, and to permit
7 8
 %% persons to whom the Software is furnished to do so, subject to the
8 9
 %% following conditions:
9  
-%% 
  10
+%%
10 11
 %% The above copyright notice and this permission notice shall be included
11 12
 %% in all copies or substantial portions of the Software.
12  
-%% 
  13
+%%
13 14
 %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 15
 %% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 16
 %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
@@ -32,7 +33,7 @@
32 33
 	]).
33 34
 
34 35
 %% ----------------------------------------------------------------------------
35  
--define(IS_CHAR(Char), 
  36
+-define(IS_CHAR(Char),
36 37
 	is_integer(Char), ((Char >= 0) andalso (Char =< 255))).
37 38
 
38 39
 %% ----------------------------------------------------------------------------
@@ -47,7 +48,7 @@ check({OriginalFormatStr, TranslatedFormatStr}, Ignores, Acc) ->
47 48
     %% convert to ehtml
48 49
     Oehtml = gettext_yaws_html:h2e(OriginalFormatStr),
49 50
     Tehtml = gettext_yaws_html:h2e(TranslatedFormatStr),
50  
-    LocalAcc = look_for_bad_tags(Oehtml, Tehtml, [], 
  51
+    LocalAcc = look_for_bad_tags(Oehtml, Tehtml, [],
51 52
 				 {OriginalFormatStr, TranslatedFormatStr}),
52 53
 
53 54
     %% check if any errors/warings should be ignored
@@ -73,53 +74,53 @@ check({OriginalFormatStr, TranslatedFormatStr}, Ignores, Acc) ->
73 74
 look_for_bad_tags([], [], Acc, _) -> Acc;
74 75
 
75 76
 %% [EHTML] - E is a tag
76  
-look_for_bad_tags([E|_], [], Acc, Info) when is_tuple(E) -> 
  77
+look_for_bad_tags([E|_], [], Acc, Info) when is_tuple(E) ->
77 78
     {OriginalFormatStr, TranslatedFormatStr} = Info,
78  
-    [{'Warning', 
  79
+    [{'Warning',
79 80
       "Tag is missing from the translation (this may be a error)",
80  
-      {original,    OriginalFormatStr}, 
  81
+      {original,    OriginalFormatStr},
81 82
       {translation, TranslatedFormatStr},
82 83
       {tag, E}} | Acc];
83 84
 
84 85
 %% [EHTML] - E isn't a tag - ensure that this hold true for R
85  
-look_for_bad_tags([E|R], [], Acc, Info) -> 
  86
+look_for_bad_tags([E|R], [], Acc, Info) ->
86 87
     Acc2 = look_for_bad_tags(E, [], Acc, Info),
87 88
     look_for_bad_tags(R, [], Acc2, Info);
88 89
 
89 90
 %% [EHTML] - E is a tag
90  
-look_for_bad_tags([], [E|_], Acc, Info) when is_tuple(E) -> 
  91
+look_for_bad_tags([], [E|_], Acc, Info) when is_tuple(E) ->
91 92
     {OriginalFormatStr, TranslatedFormatStr} = Info,
92  
-    [{'Warning', 
  93
+    [{'Warning',
93 94
       "Tag has been added to translation (this may be ok)",
94  
-      {original,    OriginalFormatStr}, 
  95
+      {original,    OriginalFormatStr},
95 96
       {translation, TranslatedFormatStr},
96 97
       {tag, E}} | Acc];
97 98
 
98 99
 %% [EHTML] - E isn't a tag - ensure that this hold true for R
99  
-look_for_bad_tags([], [E|R], Acc, Info) -> 
  100
+look_for_bad_tags([], [E|R], Acc, Info) ->
100 101
     Acc2 = look_for_bad_tags([], E, Acc, Info),
101 102
     look_for_bad_tags([], R, Acc2, Info);
102 103
 
103 104
 %% [EHTML] - both trees are non-empty - check first entry for error
104  
-look_for_bad_tags(Ehtml1, Ehtml2, Acc, Info) 
105  
-  when is_list(Ehtml1), is_list(Ehtml2) -> 
  105
+look_for_bad_tags(Ehtml1, Ehtml2, Acc, Info)
  106
+  when is_list(Ehtml1), is_list(Ehtml2) ->
106 107
     Acc2 = look_for_bad_tags(hd(Ehtml1), hd(Ehtml2), Acc, Info),
107 108
     look_for_bad_tags(tl(Ehtml1), tl(Ehtml2), Acc2, Info);
108 109
 
109 110
 
110 111
 %% -------------
111 112
 %% {Tag, Attrs, Body} - tag and attrs match
112  
-look_for_bad_tags({Tag, Attrs, Body1}, {Tag, Attrs, Body2}, Acc, Info) 
113  
-  when is_atom(Tag), is_list(Attrs) -> 
  113
+look_for_bad_tags({Tag, Attrs, Body1}, {Tag, Attrs, Body2}, Acc, Info)
  114
+  when is_atom(Tag), is_list(Attrs) ->
114 115
     look_for_bad_tags(Body1, Body2, Acc, Info);
115 116
 %% {Tag, Attrs, Body} - tag or attrs differ
116  
-look_for_bad_tags({Tag1, Attrs1, _}, {Tag2, Attrs2, _}, Acc, Info) 
117  
-  when is_atom(Tag1), is_list(Attrs1), is_atom(Tag2), is_list(Attrs2) -> 
  117
+look_for_bad_tags({Tag1, Attrs1, _}, {Tag2, Attrs2, _}, Acc, Info)
  118
+  when is_atom(Tag1), is_list(Attrs1), is_atom(Tag2), is_list(Attrs2) ->