-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from leotiger/develop
Update master
- Loading branch information
Showing
382 changed files
with
134,186 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# v1.0.0 | ||
## 08-08-2018 | ||
|
||
1. [](#new) | ||
* Changelog started | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,67 @@ | ||
# grav-plugin-babel | ||
# [Grav](http://getgrav.org) Babel | ||
|
||
**If you encounter any issues, please don't hesitate | ||
to [report | ||
them](https://github.com/leotiger/grav-plugin-babel/issues).** | ||
|
||
|
||
## What does this plugin offer? | ||
|
||
As of version 1.0.0 this plugin offers a solution to index and edit all existing language variables configured in a GRAV instance | ||
in one place. The plugin furthermore allows to export translation sets for domains and given languages. These files can be used to help | ||
plugin and theme authors to complete their language sets. In the future this plugin may offer a shared repository for language definitions, | ||
both for charging as well as storing language definitions in the context of plugins and themes. | ||
|
||
## Introduction | ||
|
||
GRAV did not dispose of an easy feature to handle and maintain the language definitions spread over all the system in plugins, themes, etc. | ||
|
||
With the advent of the Babel plugin this changes a bit. | ||
|
||
## Usage | ||
|
||
To use the plugin you have to enable language support for you GRAV instance and you have to configure as well the languages you want to | ||
handle with Babel in the plugin configuration. The languages handled by Babel do not have to be identical with the languages enabled for your | ||
instance. This allows you to prepare additional languages before activating new ones for your site. | ||
|
||
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. | ||
|
||
## 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) | ||
|
||
## Installation | ||
|
||
Installing the Babel plugin can be done in three ways. Once approved for GRAV, the GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file. | ||
|
||
If you install manually please assure yourself that the plugin folder inside /user/plugins directory is named babel. | ||
|
||
The third method is through the Administration Panel. | ||
|
||
### Administration Panel Installation (Preferred) | ||
|
||
The simplest way to install this plugin is via the [Grav Admininitration Panel](https://learn.getgrav.org/admin-panel/plugins). Once inside of the Plugins section click ADD and select the | ||
Babel for installation. | ||
|
||
|
||
### GPM Installation | ||
|
||
Another simple way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's terminal (also called the command line). From the root of your Grav instance type: | ||
|
||
bin/gpm install babel | ||
|
||
This will install the Babel plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/babel`. | ||
|
||
## Help | ||
|
||
Help can be obtained via the [issue section](https://github.com/leotiger/grav-plugin-babel/issues) but we cannot guarantee to answer in a timely or exhaustive fashion. | ||
|
||
## Credits | ||
|
||
Thanks Trilby Media for [TNTSearch](https://github.com/trilbymedia/grav-plugin-tntsearch). This plugin uses modified code portions. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: Babel | ||
template: babel_domains | ||
|
||
access: | ||
admin.babel: true | ||
admin.super: true | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: Babel domains | ||
template: babel_domains | ||
|
||
access: | ||
admin.babel: true | ||
admin.super: true | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% extends 'partials/base.html.twig' %} | ||
|
||
{% if admin.route %} | ||
{% set context = admin.page(true) %} | ||
{% endif %} | ||
|
||
{% block titlebar %} | ||
<h1><i class="fa fa-fw fa-file-text-o"></i> {{ "PLUGIN_BABEL.BABEL"|tu }}</h1> | ||
{% endblock %} | ||
|
||
{% block content_top %} | ||
{% endblock %} | ||
|
||
|
||
{% block content %} | ||
|
||
{% endblock %} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
{% extends 'babel_base.html.twig' %} | ||
|
||
{% block content %} | ||
<style> | ||
th { background: #d9d9d9; } | ||
tr, td { text-align: left;} | ||
.details { flex: 1.5 } | ||
.center { | ||
margin: 0 auto; | ||
text-align: center; | ||
} | ||
</style> | ||
<div class="index-status"> | ||
{% if babel_index_status.status %} | ||
<button id="babel-index" class="button reindex babel-reindex">{{ "PLUGIN_BABEL.REINDEX"|tu }}</button> | ||
<span class="babel-status success"><i class="fa fa-language"></i> {{ babel_index_status.msg }}</span> | ||
{% else %} | ||
<button id="babel-index" class="button critical babel-reindex">{{ "PLUGIN_BABEL.INDEX"|tu }}</button> | ||
<span class="babel-status error"><i class="fa fa-warning"></i> {{ babel_index_status.msg }}</span> | ||
{% endif %} | ||
{% if babelstats %} | ||
<button id="babel-reset" class="button reset babel-reset">{{ "PLUGIN_BABEL.RESET"|tu }}</button> | ||
<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> | ||
|
||
|
||
<div class="admin-block"> | ||
|
||
|
||
<!--<input type="text" placeholder="{{ "PLUGIN_BABEL.SEARCH"|t|e }}" /> | ||
<br />--> | ||
{% if babelstats %} | ||
<select id="babeldomains"> | ||
<option value="*" {{ current_domain == '*' ? 'selected="selected"' : '' }}>{{ "PLUGIN_BABEL.ALL_DOMAINS"|tu }}</option> | ||
<option value="*b" {{ current_domain == '*b' ? 'selected="selected"' : '' }}>{{ "PLUGIN_BABEL.BABEL_TOUCHED"|tu }}</option> | ||
{% for domain in domains %} | ||
<option value="{{ domain }}" {{ current_domain == domain ? 'selected="selected"' : '' }}>{{ domain }}</option> | ||
{% endfor %} | ||
</select> | ||
|
||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th>{{ "PLUGIN_BABEL.TRANSLATION_SET"|tu }}</th> | ||
<!--<th>{{ "PLUGIN_BABEL.DOMAIN"|tu }}</th>--> | ||
<th>{{ "PLUGIN_BABEL.DEFINED"|tu }}</th> | ||
<th>{{ "PLUGIN_BABEL.TRANSLATED"|tu }}</th> | ||
<th>{{ "PLUGIN_BABEL.UNTRANSLATED"|tu }}</th> | ||
<th>{{ "PLUGIN_BABEL.RATIO"|tu }}</th> | ||
<th>{{ "PLUGIN_BABEL.EXPORT"|tu }}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for lang, stats in babelstats %} | ||
<tr> | ||
<td>{{ lang }}</td> | ||
{#<td>{{ domain ? (domain == '*b' ? 'babelized' : domain) : '*' }}</td>#} | ||
<!--<td>{{ current_domain }}</td>--> | ||
{% if stats.all %} | ||
<td><button class="button all" data-count="{{ stats.all }}" data-lang="{{ lang }}">{{ stats.all }}</button></td> | ||
{% else %} | ||
<td>{{ stats.all }}</td> | ||
{% endif %} | ||
{% if stats.translated %} | ||
<td><button class="button translated" data-count="{{ stats.translated }}" data-lang="{{ lang }}">{{ stats.translated }}</button></td> | ||
{% else %} | ||
<td>{{ stats.translated }}</td> | ||
{% endif %} | ||
{% if stats.untranslated %} | ||
<td><button class="button untranslated" data-count="{{ stats.untranslated }}" data-lang="{{ lang }}">{{ stats.untranslated }}</button></td> | ||
{% else %} | ||
<td>{{ stats.untranslated }}</td> | ||
{% endif %} | ||
{% if stats.all %} | ||
<td>{{ ((stats.translated / stats.all * 100)|number_format('2')) }}%</td> | ||
{% else %} | ||
<td>0.00%</td> | ||
{% endif %} | ||
{% if current_domain in ['*', '*b'] or current_domain is empty %} | ||
<td> | ||
</td> | ||
{% else %} | ||
<td> | ||
<button class="button export" data-domain="{{ current_domain }}" data-lang="{{ lang }}">{{ "PLUGIN_BABEL.EXPORT"|t }}</button> | ||
</td> | ||
{% endif %} | ||
|
||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% endif %} | ||
<div id="babels"> | ||
</div> | ||
<br> | ||
<table id='babels_table' class="table table-striped table-no-bordered table-hover" cellspacing="0" width="100%" style="width:100%"> | ||
<thead> | ||
<tr> | ||
<th>{{ "PLUGIN_BABEL.DEFINITION"|tu }}</th> | ||
<th>{{ "PLUGIN_BABEL.TRANSLATION"|tu }}</th> | ||
<th>{{ "PLUGIN_BABEL.TRANSLATIONS"|tu }}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
|
||
</tbody> | ||
</table> | ||
|
||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
.index-status { | ||
border: 1px solid transparent; | ||
} | ||
.index-status span { | ||
padding: 0.3rem 0.7rem; | ||
border-radius: 4px; | ||
line-height: 1.7; | ||
vertical-align: middle; | ||
display: inline-block; | ||
} | ||
.index-status .error { | ||
background: #ddd; | ||
color: #c00; | ||
} | ||
.index-status .success { | ||
border: 1px solid #ddd; | ||
color: #999; | ||
} | ||
#admin-main .admin-block .index-status .button.critical { | ||
background: #c00; | ||
color: #fff; | ||
} | ||
|
||
#admin-main .admin-block .index-status .button.reindex { | ||
background: #0079BA; | ||
color: #fff; | ||
} | ||
|
||
#admin-main .admin-block .babel_definition { | ||
position: relative; | ||
display: block; | ||
width: 100%; | ||
} | ||
|
||
#admin-main .admin-block .babel_save { | ||
position:absolute; | ||
right: 0; | ||
top: 0; | ||
display: inline-block; | ||
text-align: center; | ||
font-size:larger; | ||
} | ||
|
||
#admin-main .admin-block .babel_save i { | ||
margin-right: 0; | ||
} | ||
|
||
.babel-error-details { | ||
padding: .2rem .5rem; | ||
margin: 1rem 0; | ||
border-radius: 3px; | ||
display: none; | ||
} | ||
|
Oops, something went wrong.