42
42
* Portions Copyright (c) 1994, Regents of the University of California
43
43
* Portions taken from FreeBSD.
44
44
*
45
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.148 2007/10/24 20:11:00 alvherre Exp $
45
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.149 2007/10/25 20:22:53 tgl Exp $
46
46
*
47
47
*-------------------------------------------------------------------------
48
48
*/
@@ -719,7 +719,7 @@ get_encoding_id(char *encoding_name)
719
719
720
720
/*
721
721
* Support for determining the best default text search configuration.
722
- * We key this offLC_CTYPE, after stripping its encoding indicator if any .
722
+ * We key this offthe first part of LC_CTYPE (ie, the language name) .
723
723
*/
724
724
struct tsearch_config_match
725
725
{
@@ -729,39 +729,37 @@ struct tsearch_config_match
729
729
730
730
static const struct tsearch_config_match tsearch_config_languages []=
731
731
{
732
- {"danish" ,"da_DK " },
733
- {"danish" ,"Danish_Denmark " },
734
- {"dutch" ,"nl_NL " },
735
- {"dutch" ,"Dutch_Netherlands " },
732
+ {"danish" ,"da " },
733
+ {"danish" ,"Danish " },
734
+ {"dutch" ,"nl " },
735
+ {"dutch" ,"Dutch " },
736
736
{"english" ,"C" },
737
737
{"english" ,"POSIX" },
738
- {"english" ,"en_US" },
739
- {"english" ,"English_America" },
740
- {"english" ,"en_UK" },
741
- {"english" ,"English_Britain" },
742
- {"finnish" ,"fi_FI" },
743
- {"finnish" ,"Finnish_Finland" },
744
- {"french" ,"fr_FR" },
745
- {"french" ,"French_France" },
746
- {"german" ,"de_DE" },
747
- {"german" ,"German_Germany" },
748
- {"hungarian" ,"hu_HU" },
749
- {"hungarian" ,"Hungarian_Hungary" },
750
- {"italian" ,"it_IT" },
751
- {"italian" ,"Italian_Italy" },
752
- {"norwegian" ,"no_NO" },
753
- {"norwegian" ,"Norwegian_Norway" },
754
- {"portuguese" ,"pt_PT" },
755
- {"portuguese" ,"Portuguese_Portugal" },
756
- {"romanian" ,"ro_RO" },
757
- {"russian" ,"ru_RU" },
758
- {"russian" ,"Russian_Russia" },
759
- {"spanish" ,"es_ES" },
760
- {"spanish" ,"Spanish_Spain" },
761
- {"swedish" ,"sv_SE" },
762
- {"swedish" ,"Swedish_Sweden" },
763
- {"turkish" ,"tr_TR" },
764
- {"turkish" ,"Turkish_Turkey" },
738
+ {"english" ,"en" },
739
+ {"english" ,"English" },
740
+ {"finnish" ,"fi" },
741
+ {"finnish" ,"Finnish" },
742
+ {"french" ,"fr" },
743
+ {"french" ,"French" },
744
+ {"german" ,"de" },
745
+ {"german" ,"German" },
746
+ {"hungarian" ,"hu" },
747
+ {"hungarian" ,"Hungarian" },
748
+ {"italian" ,"it" },
749
+ {"italian" ,"Italian" },
750
+ {"norwegian" ,"no" },
751
+ {"norwegian" ,"Norwegian" },
752
+ {"portuguese" ,"pt" },
753
+ {"portuguese" ,"Portuguese" },
754
+ {"romanian" ,"ro" },
755
+ {"russian" ,"ru" },
756
+ {"russian" ,"Russian" },
757
+ {"spanish" ,"es" },
758
+ {"spanish" ,"Spanish" },
759
+ {"swedish" ,"sv" },
760
+ {"swedish" ,"Swedish" },
761
+ {"turkish" ,"tr" },
762
+ {"turkish" ,"Turkish" },
765
763
{NULL ,NULL }/* end marker */
766
764
};
767
765
@@ -777,15 +775,15 @@ find_matching_ts_config(const char *lc_type)
777
775
* ptr ;
778
776
779
777
/*
780
- * Convert lc_ctype to a language name by stripping".utf8", "@euro", or
781
- *what-have-you
778
+ * Convert lc_ctype to a language name by strippingeverything after
779
+ *an underscore. Just for paranoia, we also stop at '.' or '@'.
782
780
*/
783
781
if (lc_type == NULL )
784
782
langname = xstrdup ("" );
785
783
else
786
784
{
787
785
ptr = langname = xstrdup (lc_type );
788
- while (* ptr && * ptr != '.' && * ptr != '@' )
786
+ while (* ptr && * ptr != '_' && * ptr != ' .'&& * ptr != '@' )
789
787
ptr ++ ;
790
788
* ptr = '\0' ;
791
789
}