How to get the file names of file-based TMs in a project

I am trying to get the file paths of the TMs of a given project. In particular, I am trying the following code with the project named "Sample Project" that comes with Studio 2014 and that has 3 languages (German, French, and Japanese) and 3 TMs, one for each language pair.

        public static void GetTMFileNames(FileBasedProject aProject)
        {
            TranslationProviderConfiguration tpc = aProject.GetTranslationProviderConfiguration();

            foreach (TranslationProviderCascadeEntry tpe in tpc.Entries)
            {
                List<TranslationProviderReference> tprs = tpe.ProjectTranslationMemories;
                foreach (TranslationProviderReference tpr in tprs)
                {
                    MessageBox.Show("URI is " + tpr.Uri.ToString());
                }
            }
        }

For some reason, the MessageBox.Show sentence is never executed, which means that the list is empty.  I also tried with GetTranslationProviderConfiguration(language)where language is one of the target languages of the project, but the MessageBox.Show sentence is not executed either.

Am I getting wrong how the TM information for file-based TMs is stored in the project?

Josep.

Parents Reply Children