Skip to content
This repository was archived by the owner on Feb 16, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public function registerBundles()
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),

new JMS\DiExtraBundle\JMSDiExtraBundle($this),
new JMS\AopBundle\JMSAopBundle(),
new JMS\I18nRoutingBundle\JMSI18nRoutingBundle(),
new JMS\TranslationBundle\JMSTranslationBundle(),
new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(),
Expand Down
130 changes: 130 additions & 0 deletions app/Resources/JMSTranslationBundle/views/Translate/index.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{% extends "SumoCodersFrameworkCoreBundle::base.html.twig" %}

{% block header_title %}
<h2>
{{ 'navigation.translations'|trans|capitalize }}
</h2>
{% endblock %}

{% block javascripts %}
{{ parent() }}

<script language="javascript" type="text/javascript">
$(document).ready(function() {
var updateMessagePath = {{ path("jms_translation_update_message", {"config": selectedConfig, "domain": selectedDomain, "locale": selectedLocale})|json_encode|raw }};

$('#config select').change(function() {
$(this).parent().submit();
});

{% if isWriteable is sameas(true) %}
$('textarea')
.blur(function() {
var self = this;
$.ajax(updateMessagePath + '?id=' + encodeURIComponent($(this).data('id')), {
type: 'POST',
headers: {'X-HTTP-METHOD-OVERRIDE': 'PUT'},
data: {'_method': 'PUT', 'message': $(this).val()},
dataType: 'html',
error: function() {
$(self).parent().prepend('<div class="alert-message error">Translation could not be saved</div>');
},
success: function() {
$(self).parent().prepend('<div class="alert-message success">Translation was saved.</div>');
},
complete: function() {
var parent = $(self).parent();
$(self).data('timeoutId', setTimeout(function() {
$(self).data('timeoutId', undefined);
parent.children('.alert-message').fadeOut(300, function() { $(this).remove(); });
}, 10000));
}
});
})
.focus(function() {
this.select();

var timeoutId = $(this).data('timeoutId');
if (timeoutId) {
clearTimeout(timeoutId);
$(this).data('timeoutId', undefined);
}

$(this).parent().children('.alert-message').remove();
})
;
{% endif %}
});
</script>
{% endblock %}

{% block main %}

<div class="row">
<form id="config" action="{{ path("jms_translation_index") }}" method="get">
<div class="form-group">
<div class="col-sm-3">
<select name="config" class="form-control">
{% for config in configs %}
<option value="{{ config }}"{% if config == selectedConfig %} selected="selected"{% endif %}>{{ config }}</option>
{% endfor %}
</select>
</div>

<div class="col-sm-3">
<select name="domain" class="form-control">
{% for domain in domains %}
<option value="{{ domain }}"{% if domain == selectedDomain %} selected="selected"{% endif %}>{{ domain }}</option>
{% endfor %}
</select>
</div>

<div class="col-sm-2">
<select name="locale" class="form-control">
{% for locale in locales %}
<option value="{{ locale }}"{% if locale == selectedLocale %} selected="selected"{% endif %}>{{ locale }}</option>
{% endfor %}
</select>
</div>
</div>
</form>
</div>

{% if isWriteable is sameas(false) %}
<div class="alert-message error">
The translation file "<strong>{{ file }}</strong>" is not writable.
</div>
{% endif %}

{% if "xliff" != format %}
<div class="alert-message warning">
Due to limitations of the different loaders/dumpers, some features are unfortunately limited to the XLIFF format.

<br /><br />

However, you can easily convert your existing translation files to the XLIFF format by running:<br />
<code>php app/console translation:extract {{ selectedLocale }} --config={{ selectedConfig }} --output-format=xliff</code>
</div>
{% endif %}

<div class="row">
<div class="col-sm-12">
<h2>Available Messages</h2>
</div>
</div>

{% if newMessages is not empty %}
<div class="row">
<div class="col-sm-12">
<h3>New Messages</h3>
{% include "JMSTranslationBundle:Translate:messages.html.twig" with {"messages": newMessages} %}
</div>
</div>
{% endif %}

{% if existingMessages is not empty %}
<h3>Existing Messages</h3>
{% include "JMSTranslationBundle:Translate:messages.html.twig" with {"messages": existingMessages} %}
{% endif %}

{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<div class="row">
<div class="col-sm-4">
<h5>ID</h5>
</div>
<div class="col-sm-4">
<h5>Translation</h5>
</div>
<div class="col-sm-4">
<h5>Additional Information</h5>
</div>
</div>
<div class="row">
<div class="col-sm-12">
{% for id, message in messages %}
<hr>
<div class="row">
<div class="col-sm-2">
<a class="jms-translation-anchor" id="{{ id }}" />
<abbr title="{{ id }}">{{ id|truncate(20) }}</abbr>
</div>
<div class="col-sm-5">
<textarea data-id="{{ id }}" class="form-control"{% if isWriteable is sameas(false) %} readonly="readonly"{% endif %}>{{ message.localeString }}</textarea>
</div>
<div class="col-sm-5">
{% if message.meaning is not empty %}
<h6>Meaning</h6>
<p>{{ message.meaning }}</p>
{% endif %}

{% if alternativeMessages[id] is defined %}
<h6>Alternative Translations</h6>
{% for locale, altMessage in alternativeMessages[id] %}
<p>
<strong>{{ locale }}:</strong> <pre>{{ altMessage.localeString }}</pre>
</p>
{% endfor %}
{% endif %}

{% if message.sources|length > 0 %}
<h6>Sources</h6>
<ul>
{% for source in message.sources %}
<li>{{ source }}</li>
{% endfor %}
</ul>
{% endif %}

{% if message.desc is not empty
and message.localeString != message.desc
and id != message.desc
and (alternativeMessages[id][sourceLanguage] is not defined
or alternativeMessages[id][sourceLanguage].localeString != message.desc) %}
<h6>Description</h6>
<p>{{ message.desc }}</p>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</div>
76 changes: 76 additions & 0 deletions app/Resources/translations/messages.en.xliff
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2015-09-28T17:57:38Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
</header>
<body>
<trans-unit id="b0a98216a32426b9e66a4ac1eb6df2e96e1b495c" resname="Ok">
<jms:reference-file line="205">Controller/Tests/DatePickerController.php</jms:reference-file>
<source>Ok</source>
<target state="new">Ok</target>
</trans-unit>
<trans-unit id="4fa9cb4f780e12806844d800ceb9f1fd5b3aa611" resname="core.interface.backToTop">
<jms:reference-file line="168">Resources/views/base.html.twig</jms:reference-file>
<source>core.interface.backToTop</source>
<target state="new">core.interface.backToTop</target>
</trans-unit>
<trans-unit id="940043c6539cbc5e4ad41b51ba81410ee0726042" resname="core.warnings.oldBrowser">
<jms:reference-file line="89">Resources/views/base.html.twig</jms:reference-file>
<jms:reference-file line="87">Resources/views/empty.html.twig</jms:reference-file>
<source>core.warnings.oldBrowser</source>
<target state="new">core.warnings.oldBrowser</target>
</trans-unit>
<trans-unit id="74c3bed1bd871a5e7a769c1d43ed26876f5ab456" resname="datepicker.pickDate">
<jms:reference-file line="93">views/Form/fields.html.twig</jms:reference-file>
<source>datepicker.pickDate</source>
<target state="new">datepicker.pickDate</target>
</trans-unit>
<trans-unit id="18cbaa7a212a4ebb5aa2e50de42ed7d0209e493e" resname="dialogs.buttons.cancel">
<jms:reference-file line="8">Resources/views/dialogs.html.twig</jms:reference-file>
<source>dialogs.buttons.cancel</source>
<target state="new">dialogs.buttons.cancel</target>
</trans-unit>
<trans-unit id="1640b4ebcbbe52cd27e8dd021cd8855f7adc1462" resname="dialogs.buttons.ok">
<jms:reference-file line="9">Resources/views/dialogs.html.twig</jms:reference-file>
<source>dialogs.buttons.ok</source>
<target state="new">dialogs.buttons.ok</target>
</trans-unit>
<trans-unit id="a949ce658c796eecd6771c3736726a283283f948" resname="dialogs.close">
<jms:reference-file line="88">Resources/views/base.html.twig</jms:reference-file>
<jms:reference-file line="86">Resources/views/empty.html.twig</jms:reference-file>
<jms:reference-file line="4">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="6">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="16">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="18">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="28">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="30">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="40">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="42">Resources/views/notifications.html.twig</jms:reference-file>
<source>dialogs.close</source>
<target state="new">dialogs.close</target>
</trans-unit>
<trans-unit id="a24fac72d11e840cce6692616e27d59c04e8d82d" resname="search.forms.buttons.search">
<jms:reference-file line="127">Resources/views/base.html.twig</jms:reference-file>
<source>search.forms.buttons.search</source>
<target state="new">search.forms.buttons.search</target>
</trans-unit>
<trans-unit id="8ad4af05c07a7b7e8ccfd597d588c55963cc2378" resname="search.forms.placeholders.term">
<jms:reference-file line="122">Resources/views/base.html.twig</jms:reference-file>
<source>search.forms.placeholders.term</source>
<target state="new">search.forms.placeholders.term</target>
</trans-unit>
<trans-unit id="85077de3a110a37f49b957cbfdc2ae918ecf60f5" resname="user.header.actions.logout">
<jms:reference-file line="112">Resources/views/base.html.twig</jms:reference-file>
<source>user.header.actions.logout</source>
<target state="new">user.header.actions.logout</target>
</trans-unit>
<trans-unit id="6526289c94898f4e4d7502f2b54cedca49dd9989" resname="user.header.actions.settings">
<jms:reference-file line="111">Resources/views/base.html.twig</jms:reference-file>
<source>user.header.actions.settings</source>
<target state="new">user.header.actions.settings</target>
</trans-unit>
</body>
</file>
</xliff>
76 changes: 76 additions & 0 deletions app/Resources/translations/messages.fr.xliff
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2015-09-28T17:57:44Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
</header>
<body>
<trans-unit id="b0a98216a32426b9e66a4ac1eb6df2e96e1b495c" resname="Ok">
<jms:reference-file line="205">Controller/Tests/DatePickerController.php</jms:reference-file>
<source>Ok</source>
<target state="new">Ok</target>
</trans-unit>
<trans-unit id="4fa9cb4f780e12806844d800ceb9f1fd5b3aa611" resname="core.interface.backToTop">
<jms:reference-file line="168">Resources/views/base.html.twig</jms:reference-file>
<source>core.interface.backToTop</source>
<target state="new">core.interface.backToTop</target>
</trans-unit>
<trans-unit id="940043c6539cbc5e4ad41b51ba81410ee0726042" resname="core.warnings.oldBrowser">
<jms:reference-file line="89">Resources/views/base.html.twig</jms:reference-file>
<jms:reference-file line="87">Resources/views/empty.html.twig</jms:reference-file>
<source>core.warnings.oldBrowser</source>
<target state="new">core.warnings.oldBrowser</target>
</trans-unit>
<trans-unit id="74c3bed1bd871a5e7a769c1d43ed26876f5ab456" resname="datepicker.pickDate">
<jms:reference-file line="93">views/Form/fields.html.twig</jms:reference-file>
<source>datepicker.pickDate</source>
<target state="new">datepicker.pickDate</target>
</trans-unit>
<trans-unit id="18cbaa7a212a4ebb5aa2e50de42ed7d0209e493e" resname="dialogs.buttons.cancel">
<jms:reference-file line="8">Resources/views/dialogs.html.twig</jms:reference-file>
<source>dialogs.buttons.cancel</source>
<target state="new">dialogs.buttons.cancel</target>
</trans-unit>
<trans-unit id="1640b4ebcbbe52cd27e8dd021cd8855f7adc1462" resname="dialogs.buttons.ok">
<jms:reference-file line="9">Resources/views/dialogs.html.twig</jms:reference-file>
<source>dialogs.buttons.ok</source>
<target state="new">dialogs.buttons.ok</target>
</trans-unit>
<trans-unit id="a949ce658c796eecd6771c3736726a283283f948" resname="dialogs.close">
<jms:reference-file line="88">Resources/views/base.html.twig</jms:reference-file>
<jms:reference-file line="86">Resources/views/empty.html.twig</jms:reference-file>
<jms:reference-file line="4">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="6">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="16">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="18">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="28">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="30">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="40">Resources/views/notifications.html.twig</jms:reference-file>
<jms:reference-file line="42">Resources/views/notifications.html.twig</jms:reference-file>
<source>dialogs.close</source>
<target state="new">dialogs.close</target>
</trans-unit>
<trans-unit id="a24fac72d11e840cce6692616e27d59c04e8d82d" resname="search.forms.buttons.search">
<jms:reference-file line="127">Resources/views/base.html.twig</jms:reference-file>
<source>search.forms.buttons.search</source>
<target state="new">search.forms.buttons.search</target>
</trans-unit>
<trans-unit id="8ad4af05c07a7b7e8ccfd597d588c55963cc2378" resname="search.forms.placeholders.term">
<jms:reference-file line="122">Resources/views/base.html.twig</jms:reference-file>
<source>search.forms.placeholders.term</source>
<target state="new">search.forms.placeholders.term</target>
</trans-unit>
<trans-unit id="85077de3a110a37f49b957cbfdc2ae918ecf60f5" resname="user.header.actions.logout">
<jms:reference-file line="112">Resources/views/base.html.twig</jms:reference-file>
<source>user.header.actions.logout</source>
<target state="new">user.header.actions.logout</target>
</trans-unit>
<trans-unit id="6526289c94898f4e4d7502f2b54cedca49dd9989" resname="user.header.actions.settings">
<jms:reference-file line="111">Resources/views/base.html.twig</jms:reference-file>
<source>user.header.actions.settings</source>
<target state="new">user.header.actions.settings</target>
</trans-unit>
</body>
</file>
</xliff>
Loading