using DNTPersianUtils.Core for persian text replacements
This commit is contained in:
parent
5b013c19b1
commit
d031504128
@ -12,6 +12,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Audit.WebApi.Core" Version="15.0.5" />
|
||||
<PackageReference Include="DNTPersianUtils.Core" Version="3.9.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.3" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="3.1.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.3" />
|
||||
|
||||
@ -6934,18 +6934,6 @@
|
||||
Persian specific text utility class
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ImportedFromDesktopGanjoor.GPersianTextSync.Sync(System.String)">
|
||||
<summary>
|
||||
convert arabic characters to persian equivalents
|
||||
</summary>
|
||||
<param name="inputStr"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:RMuseum.Services.Implementation.ImportedFromDesktopGanjoor.GPersianTextSync.PersianLetters">
|
||||
<summary>
|
||||
list of persian letters
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ImportedFromDesktopGanjoor.GPersianTextSync.Farglisize(System.String)">
|
||||
<summary>
|
||||
convert persian text to simple pinglish
|
||||
|
||||
@ -14,10 +14,10 @@ using System.Data;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using RMuseum.Services.Implementation.ImportedFromDesktopGanjoor;
|
||||
using RMuseum.Models.Artifact;
|
||||
using System.Text.RegularExpressions;
|
||||
using RSecurityBackend.Services.Implementation;
|
||||
using DNTPersianUtils.Core;
|
||||
|
||||
namespace RMuseum.Services.Implementation
|
||||
{
|
||||
@ -962,9 +962,9 @@ namespace RMuseum.Services.Implementation
|
||||
|
||||
song.ArtistName = "";
|
||||
song.ArtistUrl = "";
|
||||
song.AlbumName = $"{golhaTrack.GolhaProgram.GolhaCollection.Name} » شمارهٔ {GPersianTextSync.Sync(golhaTrack.GolhaProgram.Title)}";
|
||||
song.AlbumName = $"{golhaTrack.GolhaProgram.GolhaCollection.Name} » شمارهٔ {golhaTrack.GolhaProgram.Title.ToPersianNumbers().ApplyCorrectYeKe()}";
|
||||
song.AlbumUrl = "";
|
||||
song.TrackName = $"{GPersianTextSync.Sync(golhaTrack.Timing)} {golhaTrack.Title}";
|
||||
song.TrackName = $"{golhaTrack.Timing.ToPersianNumbers().ApplyCorrectYeKe()} {golhaTrack.Title}";
|
||||
song.TrackUrl = golhaTrack.GolhaProgram.Url;
|
||||
}
|
||||
else
|
||||
|
||||
@ -7,42 +7,6 @@ namespace RMuseum.Services.Implementation.ImportedFromDesktopGanjoor
|
||||
/// </summary>
|
||||
public class GPersianTextSync
|
||||
{
|
||||
/// <summary>
|
||||
/// convert arabic characters to persian equivalents
|
||||
/// </summary>
|
||||
/// <param name="inputStr"></param>
|
||||
/// <returns></returns>
|
||||
public static string Sync(string inputStr)
|
||||
{
|
||||
return
|
||||
inputStr
|
||||
.Replace('ك', 'ک')
|
||||
.Replace('ي', 'ی')
|
||||
.Replace("ۀ", "هٔ")
|
||||
.Replace("هی", "هٔ")
|
||||
.Replace("0", "۰")
|
||||
.Replace("1", "۱")
|
||||
.Replace("2", "۲")
|
||||
.Replace("3", "۳")
|
||||
.Replace("4", "۴")
|
||||
.Replace("5", "۵")
|
||||
.Replace("6", "۶")
|
||||
.Replace("7", "۷")
|
||||
.Replace("8", "۸")
|
||||
.Replace("9", "۹");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// list of persian letters
|
||||
/// </summary>
|
||||
public static string PersianLetters
|
||||
{
|
||||
get
|
||||
{
|
||||
return "اآئأإءبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// convert persian text to simple pinglish
|
||||
/// </summary>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Dapper;
|
||||
using DNTPersianUtils.Core;
|
||||
using ganjoor;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -659,7 +660,7 @@ namespace RMuseum.Services.Implementationa
|
||||
while((await _context.UserRecitationProfiles.Where(p => p.UserId == ownerRAppUserId && p.Name == profile.Name).SingleOrDefaultAsync())!=null)
|
||||
{
|
||||
pIndex++;
|
||||
profile.Name = $"{profile.ArtistName} {GPersianTextSync.Sync(pIndex.ToString())}";
|
||||
profile.Name = $"{profile.ArtistName} {pIndex.ToPersianNumbers()}";
|
||||
}
|
||||
_context.UserRecitationProfiles.Add(profile);
|
||||
await _context.SaveChangesAsync(); //this logically should be outside this loop,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user