PersianConsole 1.0.0
dotnet add package PersianConsole --version 1.0.0
NuGet\Install-Package PersianConsole -Version 1.0.0
<PackageReference Include="PersianConsole" Version="1.0.0" />
paket add PersianConsole --version 1.0.0
#r "nuget: PersianConsole, 1.0.0"
// Install PersianConsole as a Cake Addin
#addin nuget:?package=PersianConsole&version=1.0.0
// Install PersianConsole as a Cake Tool
#tool nuget:?package=PersianConsole&version=1.0.0
PersianConsole
why this package?
Sometimes there are situations where you want to see texts in the console that the console does not support. You can use this very small package for this For example, I want this package to display Telegram bot logs on the console whene the bot is in the Iranian group.
**an important tip : ** In this document, I have used the term Farsi to use the methods of this package, but this package supports all right align languages.
to install :
dotnet add package PersianConsole --version 1.0.0
to use :
using PersianConsole;
start of work
To display Farsi texts in the console, you must call Enable method first This method does not get any parameters
ConvertConsole.Enable();
now you can use other methods
methods
currently there are only two main method
method | description |
---|---|
ConvertString() |
to convert texts(strings) to persian font |
ConvertList() |
to convert list items to persian font |
ConvertString()
This method actually reverses the text
If you don't call this method, you'll get a result like this: مالس
But if you use this method in your code, your result is correct: سلام
This method get one parameter with string
type
the parameter is the text that you want to display Farsi
see this examples :
using PersianConsole;
ConvertConsole.Enable(); //now you can see persian fonts
string text = "سلام";
Console.WriteLine(text); //we don't call ConvertString() method
output is : مالس
And see this example where we use the ConvertString()
method
using PersianConsole;
ConvertConsole.Enable(); //now you can see persian fonts
string text = "سلام";
Console.WriteLine(ConvertConsole.ConvertString(text)); //We called the ConvertString() method
and output : سلام
ConvertList()
This method actually reverses the text of the list items
And for this, it uses the ConvertString()
method in itself.
This method get one parameter with any list types like array or IEnumerable
the parameter is the list that you want to display its items Farsi
you give that method a list no matter that's an array or list or IEnumerable and this method reverse items text output always is a list, see this example without ConvertList()
:
using PersianConsole();
ConvertConsole.Enable();
string[] names = {"فارسی","سلام","ایران"};
foreach(string item in names){
Console.WriteLine(item); //we dont use ConvertList() method here
}
output is :
یسراف
مالس
ناریا
but if you call ConvertList()
method, your items will be displayed correctly
see this example with ConvertList()
:
using PersianConsole();
ConvertConsole.Enable();
string[] names = {"فارسی","سلام","ایران"};
List<string> convertedNames = ConvertConsole.ConvertList(names);//we call convertList method here
foreach(string item in convertedNames){
Console.WriteLine(item);
}
output is :
فارسی
سلام
ایران
End of work
to disable this package and this options in your console app you can call Disable() method.
using PersianConsole;
ConvertConsole.Disable();
if you call this method you can't see any of non English texts in your console application.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 305 | 7/16/2022 |