Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MN.L10n.BuildTasks/MN.L10n.BuildTasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<OutputType>Exe</OutputType>
<StartupObject>MN.L10n.BuildTasks.Program</StartupObject>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>4.0.4</Version>
<Version>4.0.5</Version>
<Authors>Chris Gårdenberg</Authors>
<Company>MultiNet Interactive AB</Company>
</PropertyGroup>
Expand Down
10 changes: 10 additions & 0 deletions MN.L10n.Tests/ParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,15 @@ public void TestEscapedStringContainerCharacterVerbatim()
Assert.Single(result);
Assert.Equal(@"Hej ""bror""\nNej", result[0].Phrase.Trim());
}

[Fact]
public void TestNewlineInJsTemplateString()
{
var src = "_s(`Hello\r\nbrother!`)";
var parser = new L10nParser();
var result = parser.Parse(src).ToList();
Assert.Single(result);
Assert.Equal("Hello\nbrother!", result[0].Phrase.Trim());
}
}
}
6 changes: 6 additions & 0 deletions MN.L10n/L10nParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ private PhraseInvocation Unescape(PhraseInvocation phraseInvocation, bool isVerb
}
else
{
if (phraseInvocation.StringContainer == '`')
{
phraseInvocation.Phrase = phraseInvocation.Phrase
.Replace("\r", "");
}

for (var i = 0; i < phraseInvocation.Phrase.Length; i++)
{
if (phraseInvocation.Phrase[i] == '\\' && i + 1 < phraseInvocation.Phrase.Length)
Expand Down
4 changes: 2 additions & 2 deletions MN.L10n/MN.L10n.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ Translation package</Description>
<PackageProjectUrl>https://github.com/MultinetInteractive/MN.L10n</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
<Copyright>© 20XX MultiNet Interactive AB</Copyright>
<Version>4.1.3</Version>
<Version>4.1.4</Version>
<LangVersion>latest</LangVersion>
<AutoIncrementPackageRevision>True</AutoIncrementPackageRevision>
<PackageReleaseNotes>Now includes analyzer</PackageReleaseNotes>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject></StartupObject>
<AssemblyVersion>4.1.3</AssemblyVersion>
<AssemblyVersion>4.1.4</AssemblyVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down