- vec = APT::Configuration::getLanguages(false, true, "en_GB.UTF-8");
- assert(vec.size() == 2);
- assert(vec[0] == "de");
- assert(vec[1] == "en");
-
- vec = APT::Configuration::getLanguages(false, false, "en_GB.UTF-8");
- assert(vec.size() == 2);
- assert(vec[0] == "en_GB");
- assert(vec[1] == "en");
-
- vec = APT::Configuration::getLanguages(false, false, "pt_PR.UTF-8");
- assert(vec.size() == 3);
- assert(vec[0] == "pt_PR");
- assert(vec[1] == "pt");
- assert(vec[2] == "en");
-
- vec = APT::Configuration::getLanguages(false, false, "ast_DE.UTF-8"); // bogus, but syntactical correct
- assert(vec.size() == 2);
- assert(vec[0] == "ast");
- assert(vec[1] == "en");
-
- vec = APT::Configuration::getLanguages(false, false, "C");
- assert(vec.size() == 1);
- assert(vec[0] == "en");
+ env[0] = "en_GB.UTF-8";
+ vec = APT::Configuration::getLanguages(false, true, env);
+ equals(vec.size(), 3);
+ equals(vec[0], "de_DE");
+ equals(vec[1], "de");
+ equals(vec[2], "en");
+
+ env[0] = "en_GB.UTF-8";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 2);
+ equals(vec[0], "en_GB");
+ equals(vec[1], "en");
+
+ // esperanto
+ env[0] = "eo.UTF-8";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 2);
+ equals(vec[0], "eo");
+ equals(vec[1], "en");
+
+ env[0] = "tr_DE@euro";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 3);
+ equals(vec[0], "tr_DE");
+ equals(vec[1], "tr");
+ equals(vec[2], "en");
+
+ env[0] = "de_NO";
+ env[1] = "de_NO:en_GB:nb_NO:nb:no_NO:no:nn_NO:nn:da:sv:en";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 6);
+ equals(vec[0], "de_NO");
+ equals(vec[1], "de");
+ equals(vec[2], "en_GB");
+ equals(vec[3], "nb_NO");
+ equals(vec[4], "nb");
+ equals(vec[5], "en");
+
+ env[0] = "pt_PR.UTF-8";
+ env[1] = "";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 3);
+ equals(vec[0], "pt_PR");
+ equals(vec[1], "pt");
+ equals(vec[2], "en");
+
+ env[0] = "ast_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(false, false, env); // bogus, but syntactical correct
+ equals(vec.size(), 3);
+ equals(vec[0], "ast_DE");
+ equals(vec[1], "ast");
+ equals(vec[2], "en");
+
+ env[0] = "C";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 1);
+ equals(vec[0], "en");
+
+ _config->Set("Acquire::Languages", "none");
+ env[0] = "C";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 0);
+
+ _config->Set("Acquire::Languages", "environment");
+ env[0] = "C";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 1);
+ equals(vec[0], "en");
+
+ _config->Set("Acquire::Languages", "de");
+ env[0] = "C";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 1);
+ equals(vec[0], "de");
+
+ _config->Set("Acquire::Languages", "fr");
+ env[0] = "ast_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 1);
+ equals(vec[0], "fr");
+ _config->Set("Acquire::Languages", "");