Coder Social home page Coder Social logo

bilinguator / b-editor Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 663 KB

Browser-based tool for aligning two texts in different languages.

License: MIT License

CSS 6.54% PHP 93.46%
aligner bilingual bilingual-files books epub fb2 languages pdf text-align text-alignment

b-editor's Introduction

Interface of B-Editor

B-Editor

B-Editor is the browser based tool for alignment texts in two different languages.

Developed by Bilinguator.com.

Contents
Getting started
Input texts requirements
Loading files
Manipulation of paragraphs
Editing paragraphs contents
Adding illustrations
Saving files
Keyboard shortcuts
Precautions

Getting started

The B-Editor aligner has been developed and tested in Google Chrome, Yandex Browser, Edge, FireFox browsers. No third-party libraries or frameworks were used during development, except JQuery 3.6.0. Our stack consists of HTML, CSS, JavaScript, PHP. We used XAMPP with PHP version 7.4.29 for development.

Put the repository contents to your web server and open index.php file in browser.

Input texts requirements

Texts must meet the requirements of the specification.

The following scheme of naming your files is highly recommended:

<BOOK_ID>_<LANG>.txt, where

  • <BOOK_ID> is a unique identifier of your book;
  • <LANG> - ISO code of the language. This part of the file name determines the size and direction of the texts (left-to-right or right-to-left).

Loading files

Put your files to be aligned in the books directory. Launch B-Editor, choose two files in the header and press the Launch button (“Play” button-like triangle Launch button) in the top right corner. Then, the paragraphs of the two chosen texts are uploaded.

Header of B-Editor

Manipulation of paragraphs

Adding new empty paragraph

Each paragraph has the plus button (Add button) on its side. Clicking it, you can add a new empty paragraph to the current place. Current paragraph and all below will be shifted down.

Deleting current paragraph

To delete a paragraph, click the diagonal cross (Delete button) on its side. All the paragraphs below will be shifted up.

Paragraphs’ indexes

Each paragraph is marked with an index. When clicking an index of a left paragraph, it appears in the upper textarea of toolbar; click a right paragraph’s index, it to appear in the lower textarea (Delete button). It is also possible to change the textareas’ values manually. These indexes are useful in the following manipulations.

Setting bookmark

The bookmark is one index corresponding to a paragraphs couple. To set a bookmark, click to the index of the left paragraph of the current couple or type it to the upper textarea in the toolbar. Click the Bookmark button (Bookmark button) to set the bookmark. The bookmark index is saved to the books/bookmarks folder named as bookmark_<BOOK_ID>_<LANG1>_<LANG2>.<BOOK1_EXTENSION>. While the file exists, the bookmark is set all the time of using B-Editor, and it is displayed on the right side of the toolbar as bookmark/total paragraphs count ratio (Progress ratio).

Moving focus to a paragraph

Click the bookmark part of the bookmark/total paragraphs count ratio to move to the bookmarked paragraph.

To move to any other paragraph, type the index of the paragraph in the upper textarea and click the To current position button (To current position button). Look at the progress bar to orient (Progress bar).

Shifting paragraphs

To shift two paragraphs of different sides to make them adjacent, choose them and click the Shift button (Shift button).

Deleting paragraph couples by indexes

To delete several paragraphs on both sides, enter the ‘from’ and ‘to’ indexes to the textareas. Click the Delete button (Delete button). Paragraph couples starting from the minimal entered index to the maximal index will be deleted. All the paragraphs below will be shifted up.

Dividing paragraphs

To divide a paragraph into two, click the position in its content wherein the paragraph must be divided. Press the Divide paragraph button (Divide paragraph button).

To divide a paragraph into several paragraphs, add newline symbols, wherein the paragraph must be divided. Press the Divide paragraph by newline button (Divide paragraph button).

Concatenating paragraphs

To concatenate two following paragraphs of one side, click on the first of it in any place. Press the Concatenate paragraphs button (Concatenate paragraphs button). The two paragraphs will be merged via empty string. To concatenate two paragraphs via space character or <delimiter> press Concatenate paragraphs via space (Concatenate paragraphs via space button) or Concatenate paragraphs via delimiter (Concatenate paragraphs via delimiter button) button respectively.

Editing paragraphs contents

Adding tags

Select text in a paragraph. Press Title (Title button), Bold (Bold button) or Italic (Italic button) button to tag the selected text with <h1></h1>, <b></b> or <i></i> respectively.

Adding delimiter

Click on the position in a paragraph. Press the Add delimiter button (Add delimiter button).

Switching case

Select a text and press the Switch case (Switch case) to change the case from upper to lower and vice versa.

Adding illustrations

Put your PNG illustrations to the books/illustrations folder. Name them as natural arabiс numbers starting from 1 like here.

To add a new illustration to the book, create a new empty paragraph, click on it and press Add illustration button (Add illustration button). The <imgℕ> tag will be inserted, where ℕ is the natural Arabic number. The <img1> corresponds to the books/illustrations/1.png file.

Saving files

Saving source texts

To save two separate source files aligned, click the Save source files button (Save source files) or press Ctrl+S keys.

Saving bilingual TXT, FB2 and EPUB books

Clone the git repository of Bilingual formats to the root directory of B-Editor. After the next launch of B-Editor, new buttons will appear:

Button Action
Save txt Save TXT
Save fb2 Save FB2
Save epub Save EPUB

All the books are saved to the books/saved folder.

Printing bilingual PDF

Clone the git repository of Print Bilingual PDF to the root directory of B-Editor. After the next launch of B-Editor, new buttons will appear:

Button Action
Save txt Print columns PDF
Save fb2 Print rows PDF

If both Bilingual formats and Print Bilingual PDF are in the B-Editor root directory, the Save in all formats button (Save in all formats) appears. Press it to save your bilingual book in TXT, FB2, EPUB formats and print the PDF in columns and rows.

Keyboard shortcuts

Keys Button Action
Ctrl+S Save source files Save source files
Ctrl+P Save txt Print columns PDF
Ctrl+Shift+P Save fb2 Print rows PDF
Ctrl+H Title button Title
Ctrl+B Bold button Bold (when text in paragraph selected)
Ctrl+I Italic button Italic
Ctrl+, Add delimiter button Add delimiter
Ctrl+L Add illustration button Add illustration
Ctrl+D Divide paragraph button Divide paragraph
Ctrl+ Shift + D Divide paragraph button Divide paragraph by newlines
Ctrl+M Concatenate paragraphs button Concatenate paragraphs
Ctrl+U Concatenate paragraphs via space button Concatenate paragraphs via space
Ctrl+Y Concatenate paragraphs via delimiter button Concatenate paragraphs via delimiter
Ctrl+O To current position button To current position
Ctrl+B Bookmark button Set bookmark (when no text in paragraph selected)

Precautions

B-Editor does not suit for working with big texts. When working with texts with more than a thousand paragraphs, the waiting time for some operations can be quite long.

b-editor's People

Contributors

bilinguator avatar dmitrii-snitkin avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

dmitrii-snitkin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.