Skip to content

Commit

Permalink
Added a language selector when you export txt to po
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkmet98 committed Jan 4, 2019
1 parent bdbf849 commit 5d2f1af
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
13 changes: 8 additions & 5 deletions Carto-chan/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ class Program
{
static void Main(string[] args)
{
Console.WriteLine("Carto-chan 1.0 - A simple converter for Cartographer TXT format to Po by Darkmet98.");
if (args.Length != 1 && args.Length != 2)
Console.WriteLine("Carto-chan 1.1 - A simple converter for Cartographer TXT format to Po by Darkmet98.");
if (args.Length != 1 && args.Length != 2 && args.Length != 3)
{
Console.WriteLine("USAGE: Carto-chan.exe <-txt/-po/credits> \"file\"");
Console.WriteLine("Convert TXT to Po: Carto-chan.exe -txt lb_script_001.txt");
Console.WriteLine("USAGE: Carto-chan.exe <-txt/-po/credits> \"file\" \"Language\"");
Console.WriteLine("If you don't specify any language, the default is \"es\".");
Console.WriteLine("Convert TXT to Po: Carto-chan.exe -txt lb_script_001.txt en");
Console.WriteLine("Convert Po to TXT: Carto-chan.exe -po lb_script_001.po");
Console.WriteLine("Show the credits: Carto-chan.exe credits");
Environment.Exit(-1);
Expand All @@ -38,7 +39,9 @@ static void Main(string[] args)
{
case "-txt":
if (args.Length == 2 && File.Exists(args[1]))
TXT.Export(args[1]);
TXT.Export(args[1], "es");
else if (args.Length == 3 && File.Exists(args[1]))
TXT.Export(args[1], args[2]);
else
Console.WriteLine("Error, the file doesn't exist");
break;
Expand Down
8 changes: 4 additions & 4 deletions Carto-chan/TXT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TXT
private static List<string> Pointers = new List<string>();
private static List<string> Text = new List<string>();

public static void Export(string file)
public static void Export(string file, string language)
{
Console.WriteLine("Exporting " + file + "...");
string[] textfile = System.IO.File.ReadAllLines(file);
Expand Down Expand Up @@ -72,16 +72,16 @@ public static void Export(string file)
}
}
}
ToPo(file);
ToPo(file, language);


}

private static void ToPo (string file)
private static void ToPo (string file, string language)
{
Po po = new Po
{
Header = new PoHeader(Gamename, "[email protected]", "es")
Header = new PoHeader(Gamename, "[email protected]", language)
{
LanguageTeam = "Fiction",
}
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@
A simple converter for Cartographer TXT format to Po.

# Usage
Carto-chan.exe <-txt/-po/credits> "file"
* Convert TXT to Po: Carto-chan.exe -txt lb_script_001.txt
Carto-chan.exe <-txt/-po/credits> "file" "language"
(If you don't specify any language, the default is "es")

* Convert TXT to Po: Carto-chan.exe -txt lb_script_001.txt en
* Convert Po to TXT: Carto-chan.exe -po lb_script_001.po
* Show the credits: Carto-chan.exe credits

# Changelog
## 1.0
* Initial version

## 1.1
* Updated Net Framework to 4.7.2
* Added a language selector when export txt to po

# Dictionary
If you need to replace some strings (like [LINE] to \n), create a "Dictionary.txt" file on the program folder and put "Value original"="Value replaced" like this ([LINE]=\n) and Carto-chan will replace the strings.
![Dictionary](https://raw.githubusercontent.com/TraduSquare/Carto-chan/master/ExampleDictionary.png)

# Credits
* Thanks to Pleonex for Yarhl libraries.
* Carto-chan's logo has been originally created in its entirety by JohnSu and thus all rights belong to him
* https://www.deviantart.com/johnsu/art/Global-Cartographer-Atlyss-560955860
* https://www.deviantart.com/johnsu/art/Global-Cartographer-Atlyss-560955860

0 comments on commit 5d2f1af

Please sign in to comment.