Repository: godotengine/godot
File: editor/plugins/packed_scene_translation_parser_plugin.cpp (C++)

Code before:
			if (!parent_path.begins_with(tabcontainer_paths[tabcontainer_paths.size() - 1])) {
				// Switch to the previous `TabContainer` this was nested in, if that was the case.
				tabcontainer_paths.pop_back();
			}

			if (is_control && auto_translating && !tabcontainer_paths.is_empty() && parent_path == tabcontainer_paths[tabcontainer_paths.size() - 1]) {
				parsed_strings.push_back(state->get_node_name(i));
			}
		}

		if (!auto_translating) {
			continue;
		}

		if (node_type == "TabContainer") {
			tabcontainer_paths.push_back(state->get_node_path(i));
		}

		for (int j = 0; j < state->get_node_property_count(i); j++) {
			String property_name = state->get_node_property_name(i, j);
			if (!lookup_properties.has(property_name) || (exception_list.has(node_type) && exception_list[node_type].has(property_name))) {
				continue;
			}

			Variant property_value = state->get_node_property_value(i, j);
			if (property_name == "script" && property_value.get_type() == Variant::OBJECT && !property_value.is_null()) {
				// Parse built-in script.
				Ref<Script> s = Object::cast_to<Script>(property_value);
				String extension = s->get_language()->get_extension();
				if (EditorTranslationParser::get_singleton()->can_parse(extension)) {
					Vector<String> temp;
					Vector<Vector<String>> ids_context_plural;
					EditorTranslationParser::get_singleton()->get_parser(extension)->parse_file(s->get_path(), &temp, &ids_context_plural);
					parsed_strings.append_array(temp);
					r_ids_ctx_plural->append_array(ids_context_plural);
				}
			} else if ((node_type == "MenuButton" || node_type == "OptionButton") && property_name == "items") {
				Vector<String> str_values = property_value;
				int incr_value = node_type == "MenuButton" ? PopupMenu::ITEM_PROPERTY_SIZE : OptionButton::ITEM_PROPERTY_SIZE;
				for (int k = 0; k < str_values.size(); k += incr_value) {
					String desc = str_values[k].get_slice(";", 1).strip_edges();
					if (!desc.is_empty()) {
						parsed_strings.push_back(desc);
					}
				}
			} else if (node_type == "FileDialog" && property_name == "filters") {
				// Extract FileDialog's filters property with values in format "*.png ; PNG Images","*.gd ; GDScript Files".
				Vector<String> str_values = property_value;
				for (int k = 0; k < str_values.size(); k++) {
					String desc = str_values[k].get_slice(";", 1).strip_edges();
					if (!desc.is_empty()) {

Review comment (suggestion):
```suggestion
			if (auto_translating && !tabcontainer_paths.is_empty() && ClassDB::is_parent_class(node_type, "Control") &&
```
Let's put a cheaper condition first

Code after:
				idx_last -= 1;
			}

			int auto_translate_mode = (int)state->get_node_property_value(i, j);
			if (auto_translate_mode == Node::AUTO_TRANSLATE_MODE_DISABLED) {
				auto_translating = false;
			}

			atr_owners.push_back(Pair(state->get_node_path(i), auto_translating));

			break;
		}

		// If `auto_translate_mode` wasn't found, that means it is set to its default value (`AUTO_TRANSLATE_MODE_INHERIT`).
		if (!auto_translate_mode_found) {
			int idx_last = atr_owners.size() - 1;
			if (idx_last > 0 && atr_owners[idx_last].first == parent_path) {
				auto_translating = atr_owners[idx_last].second;
			} else {
				atr_owners.push_back(Pair(state->get_node_path(i), true));
			}
		}

		// Parse the names of children of `TabContainer`s, as they are used for tab titles.
		if (!tabcontainer_paths.is_empty()) {
			if (!parent_path.begins_with(tabcontainer_paths[tabcontainer_paths.size() - 1])) {
				// Switch to the previous `TabContainer` this was nested in, if that was the case.
				tabcontainer_paths.remove_at(tabcontainer_paths.size() - 1);
			}

			if (auto_translating && !tabcontainer_paths.is_empty() && ClassDB::is_parent_class(node_type, "Control") &&
					parent_path == tabcontainer_paths[tabcontainer_paths.size() - 1]) {
				parsed_strings.push_back(state->get_node_name(i));
			}
		}

		if (!auto_translating) {
			continue;
		}

		if (node_type == "TabContainer") {
			tabcontainer_paths.push_back(state->get_node_path(i));
		}

		for (int j = 0; j < state->get_node_property_count(i); j++) {
			String property_name = state->get_node_property_name(i, j);
			if (!lookup_properties.has(property_name) || (exception_list.has(node_type) && exception_list[node_type].has(property_name))) {
				continue;
			}

			Variant property_value = state->get_node_property_value(i, j);