"The language code should be used when naming and installing po-files. This is not the same as the locale code. For Norwegian Bokmål the files should be named nb.po, but the locale (LANG) should be nb_NO."
Unfortunately the document quoted above doesn't explain why. Maybe the explanation is to be found in the RFCs and ISOs.
Well, probably not. This is a matter of anticipating the future.
Of course, in the case of Norwegian Bokmål, as the only locale using this language is nb_NO, there is no real issue in naming file either nb_NO.po or nb.po.
But, just imagine that, for some yet unknown reason, a nb_FR locale is developed because thousands of Norwegian people come living in France just like the British people are currently doing..:-)
Then, those people with set their locale as nb_FR but will not benefit from nb_NO translations while they would if the translation is bust "nb".
This case is indeed happening for the Catalan language. There are software and Debian packages where the Catalan translation is currently named "ca_ES" because the most Catalan translators and speakers are in Spain. However, the language is spoken in 3 countries (Spain, France and Andorra) and locales are under work by Jordi Mallach for these cases....
So, my usual recommendation is also using the ISO-639 code alone with very few exceptions:
-pt vs pt_BR as Brazilian Portuguese is indeed different from Portuguese spoken in Portugal and former colonies
-zh_TW and zh_CN as common ways to distinguish between Traditional and Simplified Chinese for the different ways to *write* the Chinese language (regardless of distrinctions about *spoken* languages : Mandarin or Cantonese for instance)
-pa_IN and pa_PK for Punjabi as used in India and Pakistan for about the same reasons : Punjabi in India uses an Indic-style script while Punjabi in pakistan uses an Arabic-style script
I'm currently not aware of others cases where the use of the country part in translations is technically useful.
I have no competence in the php specifics described by Tomas Kuliavas and why this should urge the use of xx_YY translation files, but I think that forcing the use of xx_YY is simply impossible : there are too many languages spoken in several countries (just count down the number of locales for French, Spanish, Arabic, German....).
My understansing is thatsSoftwares should make corect use of the LANGUAGE variable for choosing language alternatives. For instance, a correct LANGUAGE variable for French in France who also speaks Catalan would be:
LANGUAGE="fr_FR:fr:ca_FR:ca:en"
which gives the order used for choosing translations by gettext-compliant software. I guess that this should be something like this for Norwegian people:
LANGUAGE="nb_NO:nb:no:nn:en"
assuming that all Norwegian people speak and understand some Nynorsk as you are forced to learn it at school...:-)