Skip to content

Commit

Permalink
Merge pull request #2 from leotiger/develop
Browse files Browse the repository at this point in the history
merge changes into master
  • Loading branch information
leotiger authored Aug 8, 2018
2 parents fc87e95 + b9e73a9 commit 6945b0b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v1.0.1
## 08-08-2018

1. [](#bugfix)
* Save all definitions for merge to avoid losing previous translation work
* Show changed translation in domain context, not only in babelized context
* remove output test traces from Babel template

# v1.0.0
## 08-08-2018

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,22 @@ instance. This allows you to prepare additional languages before activating new
Once you have enabled the Babel languages you can index all language variables and existing translations. There is one magic keyboard shortcut
availabel Command/Ctrl + s which allows you to save right from within of the textarea.

## Lifecycle

It's important to understand the lifecycle of translations managed by Babel. Let's coin a term to explain what's meant with Babel Lifecycle:

the Babel session which spans from working on a fresh index till merging the results back into the system. The Babel session is recycled once you
request and generate a new index. During a Babel session all changes to language variables are tracked and you can see what you've done using the
*babelized* domain filter. Once you re-index the merged language variables the changed language variables form part of the definition corpus, the
dictionary of your instance.

## What's missing

* a common, shared language repository for GRAV
* integration with the language repository
* automatic detection of new variables after upgrades of GRAV, plugins and themes (you can nevertheless always re-index manually)
* Bit of code cleanup and less dependencies (bootstrap 3, datatables-net)
* Mark translations as private allowing for alternative public value

## Installation

Expand Down
2 changes: 0 additions & 2 deletions admin/templates/babel_domains.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
<button id="babel-merge" class="button merge babel-merge">{{ "PLUGIN_BABEL.MERGE"|tu }}</button>
{% endif %}
<div class="warning babel-error-details"></div>
{{ "DAYS_OF_THE_WEEK.TRANSLATION_TEST"|tu }}
{{ "SHOP.ITEM.BACK"|tu }}
</div>


Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Babel
version: 1.0.0
version: 1.0.1
description: Translation services for GRAV
icon: language
author:
Expand Down
7 changes: 4 additions & 3 deletions classes/BabelSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ public function getBabels($post)
$this->index->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}

$query = "SELECT * FROM babellist WHERE babelized = $babelized and language = :language" . ($status === 0 || $status === 1 ? ' AND status = :status' : '') . ($domain && $domain != 'babelized' ? ' AND domain = :domain' : "");
$query = "SELECT * FROM babellist WHERE " . ($babelized ? 'babelized = 1 and ' : '') . "language = :language" . ($status === 0 || $status === 1 ? ' AND status = :status' : '') . ($domain && $domain != 'babelized' ? ' AND domain = :domain' : "");
$stmtDoc = $this->index->prepare($query);

$stmtDoc->bindValue(':language', $lang);
Expand Down Expand Up @@ -609,8 +609,9 @@ public function mergeBabel() {
if (!file_exists($pathToExport)) {
mkdir($pathToExport);
}

$query = "SELECT route, translated FROM babellist WHERE babelized = 1 and status = 1 and language = :language ORDER BY route";

// We need to export all variables, otherwise changes done in previous Babel sessions get lost.
$query = "SELECT route, translated FROM babellist WHERE status = 1 and language = :language ORDER BY route";
$stmtDoc = $this->index->prepare($query);

$stmtDoc->bindValue(':language', $langdef);
Expand Down

0 comments on commit 6945b0b

Please sign in to comment.