anchor.diff:  %%% @end
   
   -module(ui_utils).
  +
  +-include("../block_state.hrl").
   
   -author("Mark Sebald").
   
  
positive.code: get_ui_string(UiStringId) ->
    case get_lang_mod() of
      undefined ->
        "Error: Language module not found~n";
  
      LangMod -> 
        get_map_string(UiStringId, LangMod:ui_strings())
    end.
  
  
negative.code: get_log_string(LogStringId) ->
    case get_lang_mod() of
      undefined ->
        ErrorStr = "Error: Language module not found",
        logger:error(ErrorStr),
        ErrorStr;
    
      LangMod ->
        get_map_string(LogStringId, LangMod:log_strings())
    end.
  
  
  %%
  %% Get the block type name and description strings, 
  %% corresponding to the given block module or block type string
  %%
  -spec get_block_type_strings(BlockModule :: module() | string()) -> 
                                {module(), string(), string()} | false.
  
  get_block_type_strings(BlockModule) ->
    case get_lang_mod() of
      undefined ->
        logger:error("Error: Language module not found"),
        false;
  
      LangMod ->
        % Search the list of block type strings in the language module
        % If BlockModule is an atom, search via the 1st element
        % If BlockModule is a string, search via the 2nd element
        Key = case is_atom(BlockModule) of
          true  -> 1;
          false -> 2
        end,
        lists:keyfind(BlockModule, Key, LangMod:block_type_strings())
    end.
  
  
  %%
  %% Get an attribute name string from attribute ID
  %%
  -spec get_attrib_string(AttribId :: atom()) -> string().
  
  get_attrib_string(AttribId) ->
    case get_lang_mod() of
      undefined -> 
        logger:error("Language module not found"),
        "NotFound";
    
      LangMod ->
        case lists:keyfind(AttribId, 1, LangMod:attrib_strings()) of
          {AttribId, AttribStr} -> AttribStr;
  
          % if AttribId not found in attrib strings, in the language module
          % Just return the AttribId as a string
          false -> 
            logger:warning("~p not in attrib_strings() list", [AttribId]),
            atom_to_list(AttribId)
        end
    end.
  
  
  %%
  %% Find attribute ID for the given attribute string
  %% or return not found
  %% 
  -spec get_attrib_id(AttribStr :: string()) -> value_name() | {error, not_found}.
  
  get_attrib_id(AttribStr) ->
    case get_lang_mod() of
      undefined -> 
        logger:error("Error: Language module not found"),
        {error, not_found};
  
      LangMod ->
        case lists:keyfind(AttribStr, 2, LangMod:attrib_strings()) of
          {AttribId, AttribStr} -> AttribId;
        
          false -> {error, not_found}
        end
    end.
  
  
  
  %%
  