1. Run these two commands as superuser:

UPDATE pg_database SET
  datcollate = 'norwegian-bokmal' || substr(datcollate, position('_' in datcollate))
WHERE datcollate LIKE 'Norwegian (Bokm%';

UPDATE pg_database SET
  datctype = 'norwegian-bokmal' || substr(datctype, position('_' in datcollate))
WHERE datctype LIKE 'Norwegian (Bokm%';

2. Fix up locale names in postgresql.conf. Open postgresql.conf in a text
editor, and find the settings lc_messages, lc_monetary, lc_numeric, and lc_time.
Replace the string "Norwegian (Bokmål)" with "norwegian-bokmal". For example,
if your postgresql.conf looks like this:

# These settings are initialized by initdb, but they can be changed.
lc_messages = 'Norwegian (Bokmål)_Norway.1252'			# locale for system error message
					# strings
lc_monetary = 'Norwegian (Bokmål)_Norway.1252'			# locale for monetary formatting
lc_numeric = 'Norwegian (Bokmål)_Norway.1252'			# locale for number formatting
lc_time = 'Norwegian (Bokmål)_Norway.1252'				# locale for time formatting

Change the settings like this:

lc_messages = 'norwegian-bokmal_Norway.1252'			# locale for system error message
					# strings
lc_monetary = 'norwegian-bokmal_Norway.1252'			# locale for monetary formatting
lc_numeric = 'norwegian-bokmal_Norway.1252'			# locale for number formatting
lc_time = 'norwegian-bokmal_Norway.1252'				# locale for time formatting