ERC-1444 · Stagnant · ERC · 2018-09-23
ERC-1444: Localized Messaging with Signal-to-Text
An on-chain system that turns machine codes (bytes32 keys, enums, status codes) into human-readable text in whatever language each user prefers, with a guaranteed fallback when no translation exists.
What problem does it solve?
Contracts communicate outcomes with compact machine values: booleans, enums, status codes such as ERC-1066, or a hard-coded English revert string. Raw codes are unfriendly to users, and English-only strings serve only part of the world.
ERC-1444 lets anyone publish translations of those codes on-chain, and lets each user choose which translation they want. A contract or frontend can then show "Insufficient funds", "残高不足" or a simplified explanation for the same underlying code.
How it works
There are two kinds of contract:
Localization: a simple lookup table frombytes32code to UTF-8 text, exposingtextFor(bytes32 code) returns (string). Anyone can deploy one for a language, dialect or level of detail.LocalizationPreferences: a proxy where each user registers their preferredLocalizationwithset(localization). ItstextFor(code)returns(bool wasFound, string text).
Lookup rules:
- The proxy asks the user's chosen
Localizationfor the code. - If that returns an empty string, the proxy must fall back to a default
Localizationthat has every key filled in, and returnwasFound = false. - Otherwise it returns the text with
wasFound = true.
The flag lets a UI explain why a message appears in a different language.
Strings may be templates in C printf style (%s, %d). Messages with two or more arguments should use positional parameters (%1$s, %2$s), because word order differs between languages. The spec recommends returning the template and its arguments separately and doing the interpolation off-chain.
bytes32 keys are used because they match the EVM word size. Smaller codes, such as ERC-1066's bytes1, fit inside them directly.
Sample code
A minimal Localization and an off-chain lookup through a preferences proxy (ethers v6):
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract JapaneseMessages {
mapping(bytes32 => string) private text;
constructor() {
text[bytes32(uint256(0x10))] = unicode"拒否されました";
text[bytes32(uint256(0x11))] = unicode"承認されました";
}
function textFor(bytes32 code) external view returns (string memory) {
return text[code]; // "" means not translated -> proxy falls back
}
}
import { Contract, JsonRpcProvider, zeroPadValue } from "ethers";
const provider = new JsonRpcProvider(process.env.RPC_URL);
const prefs = new Contract(
process.env.PREFS_ADDRESS!,
["function textFor(bytes32) view returns (bool, string)"],
provider,
);
const code = zeroPadValue("0x11", 32);
const [wasFound, template] = await prefs.textFor(code);
console.log(wasFound ? template : `${template} (fallback language)`);
Things to know
- Status is Stagnant. No shared, widely used registry of localizations emerged.
- The spec suggests treating
tx.originas the registering user inset. Relying ontx.originis generally discouraged, and it does not work for smart-contract wallets. - Storing many strings on-chain is costly. The spec weighed off-chain storage but chose on-chain text so that it stays available and can be used in
revertmessages. - No global registry is mandated: projects can run their own proxies or share common ones.