@Override
	public void setLanguage(LanguageTranslator translator, Register mapReg, TaskMonitor monitor)
			throws CancelledException {

		Register newReg = translator.getNewRegister(mapReg);
		if (newReg == null) {
			// register not translated - clear map
			rangeMap.dispose();
			rangeMap = null;
			return;
		}
		Register newBaseReg = newReg.getBaseRegister();

		AddressRangeMapDB tempMap = null;
		if (!newReg.isBaseRegister() || translator.isValueTranslationRequired(mapReg)) {

			// Create temporary map
			String tempName = "TEMP_MAP";
			int retry = 0;
			while (AddressRangeMapDB.exists(dbh, tempName)) {
				tempName = "TEMP_MAP" + (++retry);
			}
			tempMap = new AddressRangeMapDB(dbh, addressMap, new Lock("Test"), tempName,
				errorHandler, BinaryField.INSTANCE, false);

			// Translate range map data into tempMap
			monitor.initialize(rangeMap.getRecordCount());
			monitor.setMessage("Converting " + mapReg.getName() + " values...");
			int cnt = 0;
			AddressRangeIterator rangeIter = rangeMap.getAddressRanges();
			while (rangeIter.hasNext()) {
				if (monitor.isCancelled()) {
					tempMap.dispose();
					throw new CancelledException();
				}
				AddressRange range = rangeIter.next();
				BinaryField value = (BinaryField) rangeMap.getValue(range.getMinAddress());
				byte[] oldBytes = value.getBinaryData();
				RegisterValue regValue = new RegisterValue(mapReg, oldBytes);
				regValue = translator.getNewRegisterValue(regValue);
				if (regValue != null && regValue.hasAnyValue()) {
					byte[] newBytes = regValue.toBytes();
					tempMap.paintRange(range.getMinAddress(), range.getMaxAddress(),
						new BinaryField(newBytes));
				}
				monitor.setProgress(++cnt);
			}
		}

		String newMapName = NAME_PREFIX + newBaseReg.getName();
		if (tempMap == null) {
			if (mapName.equals(newMapName)) {
				// Nothing to change
				return;
			}
		}
		else {
			rangeMap.dispose();
			rangeMap = tempMap;
		}
		if (rangeMap != null) {
			try {
				rangeMap.setName(newMapName);
			}
			catch (DuplicateNameException e) {
				throw new AssertException("Unexpected DuplicateNameException");
			}
		}
		mapName = newMapName;
	}
@see ghidra.program.util.RangeMapAdapter#setLanguage(ghidra.program.util.LanguageTranslator, ghidra.program.model.lang.Register, ghidra.util.task.TaskMonitor)
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/register/DatabaseRangeMapAdapter.java