There are some misconceptions about what ratification means. Though it is now common for treaties to be ratified by a legislature, that has never been essential to the ratification process.
In actuality, the reason for treaty ratification is that the negotiator doesn't always have the authority to bind the nation to a treaty. In most countries, historically, the Sovereign alone held that authority. Treaties were thus ratified when the Sovereigns approves of the terms. This can easily be done in secret, since there is no need to involve large numbers of people.
Traditionally, ratification signified the consent of the sovereign to a treaty negotiated by the sovereign's plenipotentiary, who might have no means of consulting the sovereign when negotiating in distant countries.
Grenville, John, and Bernard Wasserstein, eds. The Major International Treaties of the Twentieth Century: a history and guide with texts. Routledge, 2013.
In fact, treaty ratification remains a Royal Prerogative in the United Kingdom. Even today Parliament does not get to ratify British treaties, although as @Henry noted, HM Government is now legally required to lay most treaties before Parliament for 21 days. There was no such law in 1894 or 1915.
While I'm not familiar with French constitutional law, it seems that the same is true of France during this period. Under the Third Republic, in matters of foreign affairs the President apparently inherited much of the executive powers of previous French monarchs:
According to the Constitution of 1875, the president had the power to "dispose of the armed forces," to "negotiate and ratify treaties," and in case of emergency to "declare war" . . . the French Senate never developed its constitutionally privileged position to ratify treaties or to declare war analogous to the American Senate.
Hamilton, Richard F., and Holger H. Herwig. Decisions for War, 1914-1917. Cambridge University Press, 2004.
(Even with the United States, it is technically the President, not the Senate, who ratifies treaties by signing the instruments of ratification. The common misunderstanding stems from the fact that the former can only do so with the "advice and consent" of the latter.)
In the case of Nazi Germany and Stalinist Russia, the approval of Hitler and Stalin functionally ratifies a treaty, given their autocratic control over their respective countries.