use of rhsm.data.Translation in project rhsm-qe by RedHatQE.
the class TranslationTests method testTranslationsDoNotContainOverEscapedNewlineCharacter.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21771", "RHEL7-32172" }, linkedWorkItems = { // RHSM-REQ : Translation
@LinkedItem(project = Project.RHEL6, workitemId = "RHEL6-28564", role = DefTypes.Role.VERIFIES), // RHSM-REQ : Translation
@LinkedItem(project = Project.RedHatEnterpriseLinux7, workitemId = "RHEL7-84942", role = DefTypes.Role.VERIFIES) }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.MEDIUM, automation = DefTypes.Automation.AUTOMATED, tags = "Tier3")
@Test(description = "verify that translation msgstr does NOT contain over-escaped newline character \\n (should be \n)", groups = { "Tier3Tests" }, dataProvider = "getTranslationFileDataForVerifyTranslationsDoNotContainOverEscapedNewlineCharacter_Test", enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testTranslationsDoNotContainOverEscapedNewlineCharacter(Object bugzilla, File translationFile) {
boolean warningsFound = false;
String overEscapedNewlineChar = "\\\n";
// for (File translationFile: translationFileMapForSubscriptionManager.keySet()) { // use dataProvider="getTranslationFileData",
for (Translation translation : translationFileMapForSubscriptionManager.get(translationFile)) {
if (translation.msgstr.contains(overEscapedNewlineChar) && !translation.msgid.contains(overEscapedNewlineChar)) {
log.warning("Over-escaped newline character \"" + overEscapedNewlineChar.replaceAll("\\n", "\\\\n") + "\" should not be used in the " + translationFile + " translation: " + translation);
warningsFound = true;
}
}
// }
Assert.assertTrue(!warningsFound, "No translations found containing over-escaped newline character \"" + overEscapedNewlineChar + "\".");
}
use of rhsm.data.Translation in project rhsm-qe by RedHatQE.
the class TranslationTests method testTranslationsDoNotTranslateSubStrings.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21772", "RHEL7-32178" }, linkedWorkItems = { // RHSM-REQ : Translation
@LinkedItem(project = Project.RHEL6, workitemId = "RHEL6-28564", role = DefTypes.Role.VERIFIES), // RHSM-REQ : Translation
@LinkedItem(project = Project.RedHatEnterpriseLinux7, workitemId = "RHEL7-84942", role = DefTypes.Role.VERIFIES) }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier2")
@Test(description = "verify that Red Hat product names (e.g. 'Red Hat','RHN') remain untranslated", groups = { "Tier2Tests" }, dataProvider = "getTranslationFileDataForVerifyTranslationsDoNotTranslateSubStrings_Test", enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testTranslationsDoNotTranslateSubStrings(Object bugzilla, File translationFile) {
boolean warningsFound = false;
List<String> doNotTranslateSubStrings = new ArrayList<String>();
doNotTranslateSubStrings.add("Red Hat");
doNotTranslateSubStrings.add("Dell");
// doNotTranslateSubStrings.addAll(Arrays.asList(new String[]{"RHN","RHN Classic"})); // TRANSLATORS CHOICE see https://bugzilla.redhat.com/show_bug.cgi?id=950099#c7
// doNotTranslateSubStrings.addAll(Arrays.asList(new String[]{"Red Hat Subscription Manager","Red Hat Subscription Management", "Red Hat Global Support Services" "Red Hat Customer Portal", "RHN Satellite"})); // TODO CONSIDER ADDING THESE TOO
doNotTranslateSubStrings.addAll(Arrays.asList(new String[] { "subscription-manager-migration-data", "subscription-manager", "python-rhsm", "rhn-migrate-classic-to-rhsm", "firstboot" }));
doNotTranslateSubStrings.addAll(Arrays.asList(new String[] { "consumer_types", "consumer_export", "proxy_hostname:proxy_port" }));
// from key: Unable to read mapping file: %(mappingfile)s.\nDo you have the %(package)s package installed?
doNotTranslateSubStrings.addAll(Arrays.asList(new String[] { "%(mappingfile)s", "%(package)s" }));
// from key: Date entered is invalid. Date should be in YYYY-MM-DD format (example: {dateexample})
doNotTranslateSubStrings.addAll(Arrays.asList(new String[] { "{dateexample}" }));
// Unicode bullet character // msgid "• A network connection" // msgid "• The address of a subscription management service (optional)" // msgid "• Your account login"
doNotTranslateSubStrings.addAll(Arrays.asList(new String[] { "•" }));
// msgid "This system is not yet registered. Try 'subscription-manager register --help' for more information."
doNotTranslateSubStrings.addAll(Arrays.asList(new String[] { "subscription-manager register --help" }));
// msgid "View and configure subscription-manager plugins"
doNotTranslateSubStrings.addAll(Arrays.asList(new String[] { "subscription-manager plugins" }));
// msgid "The yum plugins: %s were automatically enabled for the benefit of Red Hat Subscription Management. If not desired, use \"subscription-manager config --rhsm.auto_enable_yum_plugins=0\" to block this behavior."
doNotTranslateSubStrings.addAll(Arrays.asList(new String[] { "subscription-manager config --rhsm.auto_enable_yum_plugins=0" }));
// msgid "Unregistering from: %s:%s%s" // msgid "Registering to: %s:%s%s"
doNotTranslateSubStrings.add("%s:%s%s");
List<String> ignoreTheseExceptionalCases = new ArrayList<String>();
// ignoreTheseExceptionalCases.add("View and configure subscription-manager plugins"); // 12/8/2015 stop ignoring... will be changed by bug 1061407 in https://github.com/candlepin/subscription-manager/pull/1343/
ignoreTheseExceptionalCases.add("list subscription-manager plugin hooks");
ignoreTheseExceptionalCases.add("list subscription-manager plugin slots");
ignoreTheseExceptionalCases.add("list subscription-manager plugins");
ignoreTheseExceptionalCases.add("Warning - subscription-manager plugins were automatically enabled");
// for (File translationFile: translationFileMapForSubscriptionManager.keySet()) { // use dataProvider="getTranslationFileData",
for (Translation translation : translationFileMapForSubscriptionManager.get(translationFile)) {
for (String subString : doNotTranslateSubStrings) {
if (translation.msgid.contains(subString) && !translation.msgstr.contains(subString)) {
// ignore exceptional cases listed above
if (ignoreTheseExceptionalCases.contains(translation.msgid)) {
log.info("Exceptional case: Ignoring translated substring \"" + subString + "\" in translation: " + translation);
continue;
}
// WARNING: Substring "Red Hat" should remain untranslated in the /usr/share/locale/de/LC_MESSAGES/rhsm.mo translation: msgid='Registration with Red Hat Subscription Management is Done!' msgstr='Die Registrierung bei der Subskriptionsverwaltung ist fertig!'
if (translationFile.getPath().contains("/de/") && subString.equals("Red Hat") && translation.msgid.equals("Registration with Red Hat Subscription Management is Done!") && translation.msgstr.equals("Die Registrierung bei der Subskriptionsverwaltung ist fertig!")) {
// https://translate.google.com/#auto/en/Die%20Registrierung%20bei%20der%20Subskriptionsverwaltung%20ist%20fertig!
log.info("Exceptional case: Tolerating translated substring \"" + subString + "\" in translation " + translation + " because https://translate.google.com/ indicates the reverse translation to be \"Subscription management registration is ready!\" which ommits substring \\\"Red Hat\\\"");
continue;
}
// WARNING: Substring "Red Hat" should remain untranslated in the /usr/share/locale/ru/LC_MESSAGES/rhsm.mo translation: msgid='This system appears to already be registered to Red Hat Subscription Management.' msgstr='Система уже зарегистрирована в RHSM.'
if (translationFile.getPath().contains("/ru/") && subString.equals("Red Hat") && translation.msgid.equals("This system appears to already be registered to Red Hat Subscription Management.") && translation.msgstr.equals("Система уже зарегистрирована в RHSM.")) {
// https://translate.google.com/#auto/en/%D0%A1%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0%20%D1%83%D0%B6%D0%B5%20%D0%B7%D0%B0%D1%80%D0%B5%D0%B3%D0%B8%D1%81%D1%82%D1%80%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B0%20%D0%B2%20RHSM.
log.info("Exceptional case: Tolerating translated substring \"" + subString + "\" in translation " + translation + " because https://translate.google.com/ indicates the reverse translation to be \"The system is already registered in RHSM.\" which ommits substring \"Red Hat\".");
continue;
}
// WARNING: Substring "Red Hat" should remain untranslated in the /usr/share/locale/ru/LC_MESSAGES/rhsm.mo translation: msgid='This system has already been registered with Red Hat using RHN Classic.' msgstr='Система уже зарегистрирована в RHN Classic.'
if (translationFile.getPath().contains("/ru/") && subString.equals("Red Hat") && translation.msgid.equals("This system has already been registered with Red Hat using RHN Classic.") && translation.msgstr.equals("Система уже зарегистрирована в RHN Classic.")) {
// https://translate.google.com/#auto/en/%D0%A1%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0%20%D1%83%D0%B6%D0%B5%20%D0%B7%D0%B0%D1%80%D0%B5%D0%B3%D0%B8%D1%81%D1%82%D1%80%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B0%20%D0%B2%20RHN%20Classic.
log.info("Exceptional case: Tolerating translated substring \"" + subString + "\" in translation " + translation + " because https://translate.google.com/ indicates the reverse translation to be \"The system is already registered to RHN Classic.\" which ommits substring \"Red Hat\".");
continue;
}
// WARNING: Substring "Red Hat" should remain untranslated in the /usr/share/locale/ru/LC_MESSAGES/rhsm.mo translation: msgid='Registration with Red Hat Subscription Management is Done!' msgstr='Система успешно зарегистрирована.'
if (translationFile.getPath().contains("/ru/") && subString.equals("Red Hat") && translation.msgid.equals("Registration with Red Hat Subscription Management is Done!") && translation.msgstr.equals("Система успешно зарегистрирована.")) {
// https://translate.google.com/#auto/en/%D0%A1%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0%20%D1%83%D1%81%D0%BF%D0%B5%D1%88%D0%BD%D0%BE%20%D0%B7%D0%B0%D1%80%D0%B5%D0%B3%D0%B8%D1%81%D1%82%D1%80%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B0.
log.info("Exceptional case: Tolerating translated substring \"" + subString + "\" in translation " + translation + " because https://translate.google.com/ indicates the reverse translation to be \"The system is successfully registered.\" which ommits substring \"Red Hat\".");
continue;
}
// Substring "Red Hat" should remain untranslated in the /usr/share/locale/ru/LC_MESSAGES/rhsm.mo translation: msgid='Your system is being registered again using Red Hat Subscription Management. Red Hat recommends that customers only register once.' msgstr='Попытка повторной регистрации системы с помощью subscription-manager.'
if (translationFile.getPath().contains("/ru/") && subString.equals("Red Hat") && translation.msgid.equals("Your system is being registered again using Red Hat Subscription Management. Red Hat recommends that customers only register once.") && translation.msgstr.equals("Попытка повторной регистрации системы с помощью subscription-manager.")) {
// https://translate.google.com/#auto/en/%D0%9F%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0%20%D0%BF%D0%BE%D0%B2%D1%82%D0%BE%D1%80%D0%BD%D0%BE%D0%B9%20%D1%80%D0%B5%D0%B3%D0%B8%D1%81%D1%82%D1%80%D0%B0%D1%86%D0%B8%D0%B8%20%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D1%8B%20%D1%81%20%D0%BF%D0%BE%D0%BC%D0%BE%D1%89%D1%8C%D1%8E%20subscription-manager.
log.info("Exceptional case: Tolerating translated substring \"" + subString + "\" in translation " + translation + " because https://translate.google.com/ indicates the reverse translation to be \"Trying to re-register system via subscription-manager.\" which ommits substring \"Red Hat\".");
continue;
}
// WARNING: Substring "Red Hat" should remain untranslated in the /usr/share/locale/de_DE/LC_MESSAGES/rhsm.mo translation: msgid='Registration with Red Hat Subscription Management is Done!' msgstr='Die Registrierung bei der Subskriptionsverwaltung ist fertig!'
if (translationFile.getPath().contains("/de_DE/") && subString.equals("Red Hat") && translation.msgid.equals("Registration with Red Hat Subscription Management is Done!") && translation.msgstr.equals("Die Registrierung bei der Subskriptionsverwaltung ist fertig!")) {
// https://translate.google.com/#auto/en/Die%20Registrierung%20bei%20der%20Subskriptionsverwaltung%20ist%20fertig!
log.info("Exceptional case: Tolerating translated substring \"" + subString + "\" in translation " + translation + " because https://translate.google.com/ indicates the reverse translation to be \"Registration with the subscription management is ready!\" which ommits substring \"Red Hat\".");
continue;
}
// msgstr='Sie müssen dieses System nach Abschluss von Firstboot mithilfe des Red Hat Subscription Managers manuell mit Subskriptionen verknüpfen.'
if (subString.equals("firstboot") && translation.msgstr.contains("Firstboot")) {
log.info("Exceptional case: Ignoring punctuation of translated substring \"" + subString + "\" in translation: " + translation);
continue;
}
log.warning("Substring \"" + subString + "\" should remain untranslated in the " + translationFile + " translation: " + translation);
warningsFound = true;
}
}
}
// }
Assert.assertTrue(!warningsFound, "No translations found with substrings that should remain untranslated.");
}
Aggregations