bell notificationshomepageloginNewPostedit profile

Topic : What's a good custom language translator? I'm working on a fantasy story that has a Language of Power (TVTROPES) in it and I was trying to look around online to find an automatic translator - selfpublishingguru.com

10.02% popularity

I'm working on a fantasy story that has a Language of Power (TVTROPES) in it and I was trying to look around online to find an automatic translator for the language I came up with but can't find any.

So is there an automatic translator out there for custom made languages that I'm not seeing?


Load Full (2)

Login to follow topic

More posts by @Sarah872

2 Comments

Sorted by latest first Latest Oldest Best

10% popularity

I suspect that the best answer for what I imagine is your use-case would be for someone to write a Word or LibreOffice macro, but I wouldn't even know where to begin with that.
However, you could use Vim for this -- specifically gVim, which has a Windows version. This takes a little bit of setting up, but I think the results are worth it.
Note: While it's nowhere near as mind-bending as its critics would have you think, learning Vim is non-trivial, and beyond the scope of this answer. If you want, once you've installed gVim, you can use the Start menu to search for 'Vim Tutor' (without the quotes) to get an interactive tutorial of the basics. It's well worth learning, if you can get your head around it.
Setting up
First of all, download & install gVim from here.
You'll also need the abolish.vim plugin for its :Subvert command. Quick installation instructions for this (once you've already got gVim installed):

Create the directory C:UsersYOURUSERNAMEvimfiles, and then the directories C:UsersYOURUSERNAMEvimfilesautoload and C:UsersYOURUSERNAMEvimfilesbundle
Download Pathogen, which is a plugin manager for Vim -- it's easiest to just grab the zip file and unpack it in C:UsersYOURUSERNAMEvimfilesautoload
Download the abolish zip and extract it to the bundle directory
Create a text file called _vimrc in C:UsersYOURUSERNAME, and put the following lines within it:

.
execute pathogen#infect()
set encoding=utf-8

Now you need to create your cypher file. This will actually be a plain text file with commands for Vim. It should look something like this:
"paste from the clipboard into vim:
0put *

"The substitute commands
"Make sure you use %S rather than %s
"The 'silent!' prevents error messages
silent! %S/quick/varryn/g
silent! %S/fox/drugar/g
silent! %S/dog/foob/g

"delete the blank line which vim will have added:
$delete
"cut the text into the clipboard:
%delete *

The Magic
Let's say you have the following paragraphs:

The quick, brown fox jumps over the lazy dog. The quick, brown fox jumps over the lazy dog.
'Quick!' shouted the dog, uncharacteristically, to the fox: 'Jump over me!'

...and you want to run your cypher over it, so that every instance of 'quick' will be replaced with 'varryn' and so on. First, copy the text from your word document (or whatever). Then, open gVim and type the following (pressing enter at the end):
:source C:pathtocypher.txt

After this, you can just paste the paragraph back into your word document, et voilà:

The varryn, brown drugar jumps over the lazy foob. The varryn, brown drugar jumps over the lazy foob.
'Varryn!' shouted the foob, uncharacteristically, to the drugar: 'Jump over me!'

You might not want to have to type out the full path to your cypher file; you could put the following line at the bottom of your _vimrc:
command Cypher :source C:pathtocypher.txt

With this, you can simply type :Cypher (and press enter) without having to remember where the file is each time.
Additionally, if you type @ : within Vim, the previous command-line mode command (those starting with a :) will be repeated; so if you were translating multiple paragraphs, you would only need to type :Cypher the first time, and for all additional occasions (for as long as you leave Vim open) you could just use @ :.
Note on the Cypher File
You stated in one of the comments that you already have a cypher set up. You can use gVim to transform this into the syntax needed here, rather than typing it all up again.
I'm assuming your cypher is set up in a way similar to this -- if it's not, you can drop a comment & I'll modify this accordingly:
quick varryn
fox drugar
dog foob

Copy the lines from whatever file they're currently stored in, and open gVim. Type the following: "*p -- this will paste from your system's clipboard (rather than one of Vim's many internal clipboards -- called 'registers' by Vim).
(If you're using non-English letters, some of them might not show up properly, because the default typeface is not very good. On Windows, you should have access to the excellent Consolas; type :set guifont=Consolas:h10 (you can put this command in your _vimrc, or alternatively in a _gvimrc file, if you like).)
Then type the following command (and press enter at the end):
:%s/([^ ]*) (.*)/silent! %S/1/2/g

It's quite a long one, so if you're afraid of mistyping it, you can copy it from this answer, and then type into Vim q: (which should bring up a little frame at the bottom of you gVim window), followed by "*p to paste the command in, and then press enter.
You should now have lines like this:
silent! %S/quick/varryn/g
silent! %S/fox/drugar/g
silent! %S/dog/foob/g

Next you need to insert the other commands needed to run the cypher. Type the following commands (pressing enter at the end of each one):
:0s/^/0put *r/
:$s/$r$deleter%delete */

After these, you should have a file that looks something like this:
0put *
silent! %S/quick/varryn/g
silent! %S/fox/drugar/g
silent! %S/dog/foob/g
$delete
%delete *

Now you just need to save it:
:w C:pathtocypher.txt

And exit gVim with :q.
Limitations

Vim is a plain text editor -- it has no idea what 'italics' or 'bold' mean, so running rich text through it will strip away that stuff. There might be a way around this, if it really matters to you, but it will involve installing additional programs. (Or you could write your novel in markdown, like all the cool kids :V )
There's no problem with single-quotes ('), but if you want to include the double-quote anywhere in your cypher text you'll have to precede it with a backslash (because " is used for comments in Vim command files)


Load Full (0)

10% popularity

Well if you don't have *nix, and you're not familiar with programming, then there is one way to do it, though it might be a little slow. Word does provide a find/replace where you can quickly just replace all words in a document/selection with a word you give it. It's quick to replace, the slow part is that if you are trying to replace a whole variety of words it may take a while.

On the other hand, if you don't mind learning to program, this is a something you could learn to code in probably a few hours if you're committed. Perhaps Java would suit your needs? www.tutorialspoint.com/java/


Load Full (0)

Back to top