예제 #1
0
        private static void SetLink(ITaskItem xlf, ITaskItem output, string translatedFullPath)
        {
            // Set link metadata to logically locate translated source next to untranslated source
            // so that the correct resource names are generated.
            string link = xlf.GetMetadata(MetadataKey.Link);

            if (string.IsNullOrEmpty(link))
            {
                link = xlf.GetMetadataOrThrow(MetadataKey.XlfSource);
            }

            string linkFileName = Path.GetFileName(translatedFullPath);

            if (link.IndexOfAny(s_directorySeparatorChars) < 0)
            {
                link = linkFileName;
            }
            else
            {
                string linkDirectory = Path.GetDirectoryName(link);
                link = Path.Combine(linkDirectory, linkFileName);
            }

            output.SetMetadata(MetadataKey.Link, link);
        }
예제 #2
0
        private static void AdjustDependentUpon(ITaskItem xlf, ITaskItem output, string language)
        {
            string dependentUpon = xlf.GetMetadata(MetadataKey.DependentUpon);

            if (!string.IsNullOrEmpty(dependentUpon))
            {
                string sourceDirectory = Path.GetDirectoryName(xlf.GetMetadataOrThrow(MetadataKey.XlfSource));
                dependentUpon = Path.GetFullPath(Path.Combine(sourceDirectory, dependentUpon));
                output.SetMetadata(MetadataKey.DependentUpon, dependentUpon);
            }
        }