##### prepare instrname.cpp #####################

file( READ "${CMAKE_CURRENT_SOURCE_DIR}/instrname.cpp" _instrname_data )
string( REGEX REPLACE "[^\n]" "" _instrname_len "${_instrname_data}" )
string( LENGTH "+${_instrname_len}" _instrname_len )
set( _instrname_pos  0 )
set( _instrname_l10n "" )
while( _instrname_pos LESS ${_instrname_len} )
    # pick line
    string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\1" _line "${_instrname_data}" )
    string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\2" _instrname_data "${_instrname_data}" )
    math( EXPR _instrname_pos "${_instrname_pos}+1" )

    # write instrument name
    if( "${_line}" MATCHES "\".+\"" )
      string( REGEX MATCH "\".+\"" _line "${_line}" )
      set( _line "i18n(${_line});" )
    else( )
      set( _line "" )
    endif( )
    set( _instrname_l10n "${_instrname_l10n}${_line}\n" )
endwhile( )
file( WRITE "${CMAKE_CURRENT_SOURCE_DIR}/instrname.cpp.tde_l10n" "${_instrname_l10n}" )


##### create translation templates ##############

tde_l10n_create_template(
    CATALOG "tdemid"
    SOURCES "." "instrname.cpp.tde_l10n"
)
