示例#1
0
        public void ProcessSrcFile_EmptyString_NotPresentInOutput()
        {
            string contents = @"
somevar.Text = '';
".Replace("'", "\"");

            string expected =
                @"msgid ''
msgstr ''
'Project-Id-Version: \n'
'POT-Creation-Date: .*
'PO-Revision-Date: \n'
'Last-Translator: \n'
'Language-Team: \n'
'Plural-Forms: \n'
'MIME-Version: 1.0\n'
'Content-Type: text/plain; charset=UTF-8\n'
'Content-Transfer-Encoding: 8bit\n'

# Project-Id-Version: 
# Report-Msgid-Bugs-To: 
# POT-Creation-Date: .*
# Content-Type: text/plain; charset=UTF-8

".Replace("'", "\"");

            using (var e = new EnvironmentForTest())
            {
                Assert.That(e.MakePotFile(contents), ConstrainStringByLine.Matches(expected));
            }
        }
示例#2
0
        public void ProcessSrcFile_AllMatches_OutputsGoodPo()
        {
            string contents = @"
somevar.Text = 'FirstLocalizableString';

somevar.MyLocalizableFunction(StringCatalog.Get('SecondLocalizableString', 'SecondNotes'));

somevar.MyLocalizableFunction('~ThirdLocalizableString', 'ThirdNotes');

".Replace("'", "\"");

            string expected =
                @"msgid ''
msgstr ''
'Project-Id-Version: \n'
'POT-Creation-Date: .*
'PO-Revision-Date: \n'
'Last-Translator: \n'
'Language-Team: \n'
'Plural-Forms: \n'
'MIME-Version: 1.0\n'
'Content-Type: text/plain; charset=UTF-8\n'
'Content-Transfer-Encoding: 8bit\n'

# Project-Id-Version: 
# Report-Msgid-Bugs-To: 
# POT-Creation-Date: .*
# Content-Type: text/plain; charset=UTF-8


#: .*
msgid 'FirstLocalizableString'
msgstr ''

#: .*
#. SecondNotes
msgid 'SecondLocalizableString'
msgstr ''

#: .*
#. ThirdNotes
msgid 'ThirdLocalizableString'
msgstr ''
".Replace("'", "\"");

            using (var e = new EnvironmentForTest())
            {
                Assert.That(e.MakePotFile(contents), ConstrainStringByLine.Matches(expected));
            }
        }