File tree Expand file tree Collapse file tree 3 files changed +51
-12
lines changed
Expand file tree Collapse file tree 3 files changed +51
-12
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,23 @@ CREATE FUNCTION test_translation()
66 RETURNS void
77 AS :'regresslib'
88 LANGUAGE C;
9- -- Some BSDen are sticky about wanting a codeset name in lc_messages,
10- -- but it seems that at least on common platforms it doesn't have
11- -- to match the actual database encoding.
12- SET lc_messages = 'es_ES.UTF-8';
9+ -- There's less standardization in locale name spellings than one could wish.
10+ -- While some platforms insist on having a codeset name in lc_messages,
11+ -- fortunately it seems that it need not match the actual database encoding.
12+ do $$
13+ declare locale text; ok bool;
14+ begin
15+ for locale in values('es_ES'), ('es_ES.UTF-8'), ('es_ES.utf8')
16+ loop
17+ ok = true;
18+ begin
19+ execute format('set lc_messages = %L', locale);
20+ exception when invalid_parameter_value then
21+ ok = false;
22+ end;
23+ exit when ok;
24+ end loop;
25+ end $$;
1326SELECT test_translation();
1427NOTICE: traducido PRId64 = 424242424242
1528NOTICE: traducido PRId32 = -1234
Original file line number Diff line number Diff line change @@ -6,10 +6,23 @@ CREATE FUNCTION test_translation()
66 RETURNS void
77 AS :'regresslib'
88 LANGUAGE C;
9- -- Some BSDen are sticky about wanting a codeset name in lc_messages,
10- -- but it seems that at least on common platforms it doesn't have
11- -- to match the actual database encoding.
12- SET lc_messages = 'es_ES.UTF-8';
9+ -- There's less standardization in locale name spellings than one could wish.
10+ -- While some platforms insist on having a codeset name in lc_messages,
11+ -- fortunately it seems that it need not match the actual database encoding.
12+ do $$
13+ declare locale text; ok bool;
14+ begin
15+ for locale in values('es_ES'), ('es_ES.UTF-8'), ('es_ES.utf8')
16+ loop
17+ ok = true;
18+ begin
19+ execute format('set lc_messages = %L', locale);
20+ exception when invalid_parameter_value then
21+ ok = false;
22+ end;
23+ exit when ok;
24+ end loop;
25+ end $$;
1326SELECT test_translation();
1427NOTICE: NLS is not enabled
1528 test_translation
Original file line number Diff line number Diff line change @@ -9,10 +9,23 @@ CREATE FUNCTION test_translation()
99 AS :' regresslib'
1010 LANGUAGE C;
1111
12- -- Some BSDen are sticky about wanting a codeset name in lc_messages,
13- -- but it seems that at least on common platforms it doesn't have
14- -- to match the actual database encoding.
15- SET lc_messages = ' es_ES.UTF-8' ;
12+ -- There's less standardization in locale name spellings than one could wish.
13+ -- While some platforms insist on having a codeset name in lc_messages,
14+ -- fortunately it seems that it need not match the actual database encoding.
15+ do $$
16+ declare locale text ; ok bool;
17+ begin
18+ for locale in values (' es_ES' ), (' es_ES.UTF-8' ), (' es_ES.utf8' )
19+ loop
20+ ok = true;
21+ begin
22+ execute format(' set lc_messages = %L' , locale);
23+ exception when invalid_parameter_value then
24+ ok = false;
25+ end;
26+ exit when ok;
27+ end loop;
28+ end $$;
1629
1730SELECT test_translation();
1831
You can’t perform that action at this time.
0 commit comments