Git Product home page Git Product logo

translate's People

Contributors

bobdenotter avatar bobvandevijver avatar codmdu avatar coolak avatar dadaxr avatar doenietzomoeilijk avatar evertalbers avatar gagarine avatar guustnieuwenhuis avatar gwendolenlynch avatar herveemagma avatar lswest avatar madc avatar martinfojtik avatar nealmarques avatar nestordedios avatar padawan avatar panda-madness avatar peterverraedt avatar ridho-laksono-lamudi avatar rossriley avatar spomsoree avatar tiito78 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

translate's Issues

Any suggestions to creating a translated menu?

menu{locale}.yml or would you

main:
    - label: home/{locale}
      title: This is the first menu item.
      path: homepage
      class: first
[etc...]

p.s.: Sorry for skipping on the SEO. I'm still working on it.

*edit:
nvm. Found the answer: removing the title property from the menu will replace it with the title for the set language.

Translatable fields are not showing: dev-master (6d1a7d)

After installing and adding the correct additions to contenttypes.yml, config and updating the database.
Two issues:

  1. Existing items now have a Language tab. The tab dropdown items have links like this: http://bla.localhost/bolt/editcontent/paginas/1?_locale=en
    but the toggle to the translatable fields don't work. (page reloads instead of showing the right fields)
  2. New items don't show the language tab at all.

In both cases the translate icons for translatable filetypes are missing.

[BUG] Localeswitcher not correctly linking to translated slug

Hey,

when I use the localeswitcher with translated slugs, it just changes the locale slug in the url, but not the slug of the page.

e.g. when i have a page http://example.com/en/about-us it links to http://example.com/de/about-us even though the translated german slug is "ueber-uns".

menu.yml

main:
    - path: pages/2
    - path: pages/2
    - path: pages/2
    - path: pages/2
    - path: pages/2

contenttypes.yml excerp

pages:
    name: Pages
    singular_name: Page
    fields:
        locale:
            type: locale
            group: content
        slug:
            type: slug
            uses: title
            is_translateable: true
        title:
            type: text
            class: large
            group: content
            is_translateable: true

routing overwrite (problem exists without it aswell)

pagebinding:
  path:           /{slug}
  defaults:       { _controller: 'Bolt\Controllers\Frontend::record', 'contenttypeslug': 'page' }
  contenttype:    pages

Localeswitcher template

(how do i get the active locale first without looping twice? :D)

<ul{% if classes %} class="{{ classes }}"{% endif %}>

    {% for locale in locales %}
        {% if locale.get('active') %}
            <li class="active">
                <a title="{{ locale.get('label') }}" href="{{ locale.get('url') }}">
                    {{ locale.get('label') }}
                </a>
            </li>
        {% endif %}
    {% endfor %}

    {% for locale in locales %}
        {% if not locale.get('active') %}
            <li>
                <a title="{{ locale.get('label') }}" href="{{ locale.get('url') }}">
                    {{ locale.get('label') }}
                </a>
            </li>
        {% endif %}
    {% endfor %}

</ul>
  • Translate Version: 3.1.1
  • Install type: Extension Repository
  • Bolt Version: 3.0.12
  • PHP version: 7.0
  • Used webserver: Apache

Github webhook for extensions.bolt.cm

@madc Could you perhaps add the github webhook for this repo? The hook to add is https://extensions.bolt.cm/hook?token=7b894fc540811b2aa56da22953354fcc.

I know this is a bit odd since I can't add it since it's in your github organization but the submission to extensions.bolt.cm is in my user, but we'll make it work :)

[RFC] problem with url/routing

In the same install as in issue #66 I seem to have a problem with the routing.

It could be related with the contenttypes where I have (inside a repeated YAML node BTW)

        slug:
            type: slug
            uses: title

I saved the record after installing the extension, with slightly different text for both languages.
The url for that record used to be
/project/scira-sheringham-shoal-gb-317-mw
I would now expect it to be
/en/project/scira-sheringham-shoal-gb-317-mw

but there I get the screen below.

I suspect that I should have adapted one extra thing somewhere. Should I delete the slug field in the contenttypes?

php_fatal_error_vendor_library_-_2016-08-17_11 52 42

[BUG?] Unwanted German locale instead of Dutch

Details

  • Translate Version: [ 3.1.1 ]
  • Install type: [ Local install ]
  • Bolt Version: [ 3.0.12 ]
  • PHP version: [ 7.0 5.6 just had to switch back to 5.6 for reasons not related to this site ]
  • Used webserver: [ Apache ] version [ ? ]
  • For UX/UI issues: [ Chrome ]

Reproduction

I have installed the Translate and Labels Extension and have set the first field in the backend to is_translateable: true

In config.yml I have

  en_GB:
    label: English
    slug: en
  nl_NL:
    label: Nederlands
    slug: nl

The translation option shows up, but now lets me choose between English and German, but no Dutch.
options
(* ...which is extremely sensitive since the soccer world cup of 1974 )

I emptied the cache and checked the DB, but saw no effect.

feedback messages not being translated

boltforms does currently have no means to return translated errors

feedback:
    success: mail sent
    error: failed to send mail

I was wondering if there may be some sort of workaround
{% if form.vars.errors|length %}{% endif %}
something like that.

or in the future you may wanna go for a locale_succes/locale_error

Error adding 'locale' to DB (dev-master (e8f834))

Version: dev-master (e8f834)
Bolt version: 3.0.9. pl 1

I know it's a work in progress. But maybe it's useful.
When adding 'locale' to the contenttype.yml fields the following error occurs after trying to update the database:

"Er is een fout opgetreden tijdens het bijwerken van de 'bolt_paginas'. De fout is An exception occurred while executing 'ALTER TABLE bolt_paginas ADD locale LONGTEXT DEFAULT '[]' NOT NULL COMMENT '(DC2Type:json_array)'': SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB/TEXT column 'locale' can't have a default value"

Can't edit English content

Hi,

my default language in Bolt is Czech, I can create new entries with no problem. Everything is saved in database. But if I go to list of entries and try to open my English entry. I see only Czech texts.

Sorry for my English,
Martin

Where can I edit the localeswitcher output?

I would like to add a flagicon to every anchor. I would prefer to do this using a span or i tag, using classes to pick the backgrounds.<i class="lang"></i>. Where can I edit this?

[BUG] Page page/ not found

I posted this issue earlier right before the 3.1.2 release, and hoped it was fixed in that release. But the problem remains.

I have done multiple clean installs (Bolt 3.0.12 & 3.1.0 beta 2), and all single page views got 404 errors after installing translate. Also upgraded one install from 2.2.23 to 3.0.12 and got an fatal error (because there wasn't a 404 page in the theme):

Request URL: bolt.prod/nl/page/over-ons
Symfony\Component\HttpKernel\Exception\HttpException thrown with message "Page page/ not found."

Stacktrace:
#9 Symfony\Component\HttpKernel\Exception\HttpException in /home/vagrant/projects/bolt-prod/vendor/silex/silex/src/Silex/Application.php:400
#8 Silex\Application:abort in /home/vagrant/projects/bolt-prod/vendor/bolt/bolt/src/Controller/Base.php:62
#7 Bolt\Controller\Base:abort in /home/vagrant/projects/bolt-prod/vendor/bolt/bolt/src/Controller/Frontend.php:155
#6 Bolt\Controller\Frontend:record in /home/vagrant/projects/bolt-prod/extensions/vendor/animal/translate/src/Frontend/LocalizedFrontend.php:78
#5 Bolt\Extension\Animal\Translate\Frontend\LocalizedFrontend:record in /home/vagrant/projects/bolt-prod/vendor/symfony/http-kernel/HttpKernel.php:144
#4 call_user_func_array in /home/vagrant/projects/bolt-prod/vendor/symfony/http-kernel/HttpKernel.php:144
#3 Symfony\Component\HttpKernel\HttpKernel:handleRaw in /home/vagrant/projects/bolt-prod/vendor/symfony/http-kernel/HttpKernel.php:64
#2 Symfony\Component\HttpKernel\HttpKernel:handle in /home/vagrant/projects/bolt-prod/vendor/silex/silex/src/Silex/Application.php:586
#1 Silex\Application:handle in /home/vagrant/projects/bolt-prod/vendor/silex/silex/src/Silex/Application.php:563
#0 Silex\Application:run in /home/vagrant/projects/bolt-prod/public/index.php:14

Details

  • Translate Version: all 3.x.x releases
  • Install type: Extension Repository and Local install
  • Bolt Version: 3.0.12 and 3.1.0 beta 2
  • PHP version: 7.0
  • Used webserver: Nginx version 1.9.11 (homestead 0.5.0)

I hope this is enough info. If you need a full reproduction log, please let me know 😉

Localeswitcher returning whitespace

the code:

{{ localeswitcher('localeswitcher.twig')|raw }}

localeswitcher.twig located in my theme:

<ul class="localeswitcher">
    {% for iso, locale in locales %}
        {% if app.request.get('slug') %}
            {% set newslug = get_slug_from_locale(record, iso) ?: record.slug %}
        {% endif %}
        <li {% if locale.slug == app.request.get('_locale') %}class="active"{% endif %}>
            <a href="{{ url(
                 app.request.get('_route'), 
                 app.request.get('_route_params')|merge({_locale: locale.slug, slug: newslug })
                 )}}">
                {{ locale.label }}
            </a>
    {% endfor %}
</ul>

It returns whitespace and nothing more. Even when I remove the |raw part. Not even the ul is displayed in the document. yet no error is thrown in the system log

This is as much info as I have.

Homepage redirect no longer working

Homepage redirect no longer working since the homepage gets a default _locale since #43.

Possible duplicate content issue since the same page will happily display on both / and /{default_locale_here} (with different canonicals).

Details

  • Translate Version: master
  • Install type: Extension Repository
  • Bolt Version: master

Set current language as first in locales?

Crosspost, got no reply for days...

What approach would you recommend to display the current language as the first link in the list?
originally I had in mind to use 2 loops, loop1 to get the current selection and loop2 to display the other links. On second thought it seemed like a bad approach. The following seems like a better idea:

ul
    li class ='active' > cur lang`
    for( langs in locales){
        if(lang != cur lang){
            li>lang

The reason I would want this is because now I can tab through the list and use the active link as the trigger. What would be the way to display the current language label and the current language link so I can pull this off? Or perhaps you would recommend an entirely different approach?

I know you are using app.request.get('_locale') in the languageswitcher.twig. Can you get the label in a simular manner?

issue of $contentTables[$contentType] = $app->share() in TranslateExtension.php

There is one issue as below.
If you define some content types as en-pages or en_pages including character of _ , - ,
two tables as en-pages and en_pages will be required to create and some errors
will occur.


private function registerOverrides(Application $app) in TranslateExtension.php

$app['schema.content_tables'] = $app->extend(
'schema.content_tables',
function ($contentTables) use ($app) {
$config = $app['translate.config'];
$platform = $app['db']->getDatabasePlatform();
$prefix = $app['schema.prefix'];
$contentTypes = $app['config']->get('contenttypes');

        foreach (array_keys($contentTypes) as $contentType) {
            $contentTables[$contentType] = $app->share(function () use ($platform, $prefix, $config) {
                return new Storage\ContentTypeTable($platform, $prefix, $config);
            });
        }
        return $contentTables;
    }
);

$contentTables[$contentType] should be $contentTables[$tablename];

You could get $tableName as below.
$tableName = $contentTypes[$contentType]['tablename'];

Templatefields are translated and stored correctly, but translations can't be set

When using translatable templatefields, it seems like the extension's javascript is unable to set all the individual fields to its translated counterpart. I ran into this issue while using a template that has 10 fields, including html and image fields.

As I was troubleshooting this, I noticed the translated fields are correctly set in the bolt_translation table. The JSON stored there, is parseable. But when field_locale.js tries to parse & set the fields, this exception is thrown:

TypeError: Cannot read property 'setData' of undefined(…)

When I debug the js, it breaks in this loop:

for (var field in val) {
    setValue('templatefields[' + field + ']', val[field]);
}

Removing my html field does not help either...

pages:
    name: Pages
    singular_name: Page
    class: \Bolt\Extension\Animal\Translate\Content\LocalizedContent
    fields:
        locale:
            type: locale
            group: content
        title:
            type: text
            class: large
            group: content
            required: true
            isTranslatable: true
        slug:
            type: slug
            uses: title
        template:
            isTranslatable: true
            type: templateselect
        seo:
            isTranslatable: true
            type: seo
            group: "SEO settings"
    default_status: published
    record_template: page_basic.twig
templatefields:
    page_home.twig:
        banner_heading:
          label: Heading
          type: text
          class: large
          required: true
        banner_content:
          label: Content
          type: html
          height: 300px
          required: true
        banner_cta_title:
          label: Call to action text
          type: text
          class: small
          required: true
        banner_image:
          label: Banner image
          type: image
        products_heading:
          label: Products listing heading
          type: text
          class: large
          required: true
        contentblock_heading:
          label: Right column heading
          type: text
          class: large
          required: true
        contentblock_content:
          label: Right column content
          type: html
          info: "The text that will be shown in the right column."
        contentblock_cta_title:
          label: Right column call to action text
          type: text
          class: small
          required: true
        contentblock_cta_url:
          label: Right column call to action URL
          type: text
          class: small
        references_heading:
          label: Reference listing heading
          type: text
          class: large
          required: true

Details

  • Relevant Bolt Version: 2.2.19-pl1
  • Install type: composer
  • PHP version: 7.0.0
  • Used webserver: Apache (MAMP)

Preview and Live edit not working

First of all thank you for this great extension!
The whole thing is working nicely with bolt, except for the preview and live edit functionality.

I’m currently running Bolt 2.20 along with the latest version of this extension. And followed the installation manual from the readme.md (including the routing setup).

I did some small testing with the routing configuration. And found that after removing the "preview" section, live edit works but NOT the preview functionality.

Exceptions:
Live edit with default “preview” routing:
No exceptions

Page preview with default “preview” routing:
No route found for "POST /nl_NL/preview/page" (from http://domain.dev/bolt/editcontent/pages/2")

Live edit with extension “preview” routing:
No route found for "POST /preview/page" (from "http://domain.dev/bolt/editcontent/pages/2")

Page preview with extension “preview” routing:
No exception but undefined Page

I have no experience in developing extensions for Bolt.
So if any additional information is required, please let me know :)

[RFC] Show language slug in the backend

The slug (translated as "Permalink" in Dutch example below) field in the backend now combines contenttype/slug, conveniently showing under which url the record can be found.

edit_pagina_ projects profin_cms-_2016-08-27_08 52 22

Is it a good idea to add the language slug in this field?

And to take things one step further, to show the url with the routing settings taken into account? In this example of my site, that would be en/projects.

It might be best to show these as an extra read-only field, accompanied by some explanation of what it is you're looking at. Actually, the latter would be a suggestion for the Bolt core, and not for Bolt-translate.

php 5.3 remains instable

Allow me to first explain something from my side: the IT guy I was referring to is the one running php 5.3 and I'm the one running 5.4. He was gone past fryday so I couldn't contact him to ask if things were solved. While I'm developing on the main page in the test envirement, our IT guy is just checking if bolt with the plugins is running stable on the main system. I wouldn't have been able to contact him in his absence even if I wanted to.

These are the recent issues he's encountering:

Error: syntax error, unexpected '['
File: extensions/vendor/animal/translate/src/Controller/AsyncController.php
Line: 16
 $router->match('/get', [$this, 'getTranslationAction'])
            ->method('GET');
Error: syntax error, unexpected '['
File: extensions/vendor/animal/translate/src/Content/LocalizedContent.php
Line: 106

$defaultLocaleSlug = reset($locales)['slug'];

Error: syntax error, unexpected '['
File: extensions/vendor/animal/translate/src/Content/LocalizedContent.php
Line: 126

$this->delocalizedValues = [];

Error: Using $this when not in object context
File: extensions/vendor/animal/translate/src/Content/LocalizedContent.php
Line: 110

return $e['slug'] == $this->app['request']->get('_locale');

There may be more issues in there, but this is as far as we got.

I hope you're not taking this as critique. It was actually your plugin that made the biggest difference in deciding if using bolt cms was an option in this project. Your extension arrived just at the right moment and really your timing couldn't have been better.

I wish I could be of bigger help in terms of helping you debug and providing support, but I've always been terrible at understanding code written by others. I'm also still figuring out bolt itself in many ways. Just know that you are a doing an awesome job.

[BUG]? Can't get repeater translation inside templatefields working

First of all thank you so much for your great work on bolt and also for the great support in the slack channel!

Now to my problem:
I have a section content type which only has a templateselect. For my different types of sections I have different template and templatefields. Some of them contain repeaters, which I can't get to work with the translate plugin.

  • Translate Version: 3.1.1
  • Install type: Extension Repository
  • Bolt Version: 3.0.11
  • PHP version: 7.0
  • Used webserver: Apache version 2.4.23

config

locales:
    de_DE:
        label: Deutsch
        slug: de
    en_GB:
        label: English
        slug: en

sections contenttype:

sections:
    name: Sections
    singular_name: Section
    fields:
        locale:
            type: locale
            group: content
        title:
            type: text
            class: large
            group: content
        slug:
            type: slug
            uses: title
        template:
            type: templateselect
            filter: '*_section.twig'
            is_translateable: true
            group: content
        slug:
            type: slug
            uses: title
    record_template: image-and-text_section.twig
    default_status: published
    viewless: true
    searchable: false

templatefields for section:

templatefields:
    sections\image-and-text_section.twig:
        headline:
            type: text
            class: large
        content:
            type: html
            height: 200px
        image:
            type: image
            attrib: title
            extensions: [ gif, jpg, png ]
        contentlink:
            type: text
            label: Link
        contentlink_text:
            type: text
            label: Link Text
    sections\was-uns-auszeichnet_section.twig:
        headline:
            type: text
            title: Headline
        content_matrix:
            type: repeater
            limit: 10
            fields:
                title:
                    type: text
                    label: Titel
                bubble_size:
                    type: text
                    label: Size (small, medium, big)
                content_text:
                    type: text
                    label: Text
                bubble_color:
                    label: Color
                    type: select
                    values: { 'red': "Red", 'medium-gray': "Medium Gray", 'dark-gray': "Dark Gray", 'blue': "Blue" }
    sections\stage_section.twig:
        slides:
            type: repeater
            fields:
                image:
                    type: image
                    attrib: [title, alt]
                    extensions: [ gif, jpg, png ]
                    label: Image
                teaser_text:
                    type: html
                    height: 300px
                    label: Teaser Text
                overlay_text_top_small:
                    type: text
                    label: Image Overlay Text Top Small
                overlay_text_center_big:
                    type: text
                    label: Image Overlay Text Center Big
                overlay_text_bottom_small:
                    type: text
                    label: Image Overlay Text Bottom Small
                contentlink:
                    type: text
                    label: CTA Link
                contentlink_text:
                    type: text
                    label: CTA Text

The section without repeater works fine, in the other two I can either save my primary language (de) or if I try to save content to my secondary language (en) it will save neither.

Compatability with bolt 3.0

This is outdated, see #26 for info/code


Well, 3.0 is out, and we've know it was coming for some time... So I'm gonna try to use this as a tracker for the issues we encounter when moving the extension to 3.0.

Besides the obvious issues of extension structure we have

  • Some new nuances when it comes to mounting/overriding controllers/DI
  • New js, which will have a different event structure
  • And probably much more

So hopefully I can map this out in this week and get a plan for it.

Label translations throws error page

I think this has been going on for longer and I believe it could be due to my own misconfiguration. How do I figure out what's going on?

Page sida/labels not found.
/vendor/silex/silex/src/Silex/Application.php

Can you help me figure this out?

p.s: I just got word that we're having the same issue on the 5.3 server and it also seems that installing the 0.1.4 of translate throws an install error. I'll let you know when I know more. *update:

After updating the config.yml I get this:

Composer install breaks the language switcher in the backend

I am setting up a Bolt site, and just installed the Translate extension. As discussed in Slack, the issue I'm encountering probably is because of the composer install.

For completeness, this a part of what my contenttypes.yml looks like:

pages:
    name: Pages
    singular_name: Page
    class: \Bolt\Extension\Animal\Translate\Content\LocalizedContent
    fields:
        locale:
            type: locale
            group: content
        title:
            type: text
            class: large
            required: true
            isTranslatable: true
            error: "You must give your page a title."
            info: "This title is usually not displayed on the page, but is used throughout the CMS, and when no SEO title is specified."
        slug:
            type: slug
            uses: title
            info: "This is the text that will be used in the URL of this page."
            error: "You must give your page a slug."
        template:
            type: templateselect
    record_template: page_basic.twig
    icon_many: "fa:bookmark"
    icon_one: "fa:bookmark"

I followed all the required steps in the README of this extension, but when I switch language on a page in the back-end, the browser points me to a Whoops page with url /bolt/async/translate/get:

Bolt\Exception\PermissionLexerException thrown with message "Unexpected character ':' while parsing query contenttype::edit"

Stacktrace:
#10 Bolt\Exception\PermissionLexerException in /Volumes/128GB/Projecten/projectx/vendor/bolt/bolt/src/PermissionParser.php:224
#9 Bolt\PermissionParser:lex in /Volumes/128GB/Projecten/projectx/vendor/bolt/bolt/src/PermissionParser.php:150
#8 Bolt\PermissionParser:run in /Volumes/128GB/Projecten/projectx/vendor/bolt/bolt/src/Permissions.php:535
#7 Bolt\Permissions:isAllowed in /Volumes/128GB/Projecten/projectx/vendor/bolt/bolt/src/Users.php:1169
#6 Bolt\Users:isAllowed in /Volumes/128GB/Projecten/projectx/extensions/vendor/animal/translate/src/Controller/AsyncController.php:35
#5 Bolt\Extension\Animal\Translate\Controller\AsyncController:getTranslationAction in <#unknown>:0

When loading a page in the back-end, this error is logged in the browser console:

GET http://projectx.dev/extensions/vendor/animal/translate/assets/css/field_locale.css 404 (Not Found)
GET http://projectx.dev/extensions/vendor/animal/translate/assets/js/field_locale.js 404 (Not Found)

These files do not exist on the webserver as I am using an install outside of the webroot.

Details

  • Relevant Bolt Version: 2.2.19-pl1
  • Install type: composer
  • PHP version: 7.0.0
  • Used webserver: Apache (MAMP)

Search

What do I use to display a translated working searchbar? I've already included the snippet on the frontpage of this repository. The search bar now redirects me to an error page

default theme outputs dump()

Due to this being included in the template:

{% elseif record.fieldtype(key) not in ['templateselect'] and attribute(record, key) is not empty %}

                    {# No special case defined for this type of field. We just output it, if it's
                       a simple scalar, and 'dump' it otherwise. #}
                    <p><strong>{{ key }}: </strong>
                        {% if attribute(record, key) is iterable %}
                            {{ dump(attribute(record, key)) }}
                        {% else %}
                            {{ attribute(record, key) }}
                        {% endif %}
                    </p>

                {%  endif %}

It's not a major issue, but it may be a decent idea to make sure this output is not triggered, so that it doesn't look like things are not working correctly.

Routing question

When in a single-language site I would have e.g.

paginabinding:
    path:           /{slug}
    defaults:       { _controller: 'Bolt\Controllers\Frontend::record', 'contenttypeslug': 'pagina' }
    contenttype:    paginas

for my "pagina" contenttype to be rendered as
/pagina-slug

what should I do to get
/en/pagina-slug and /nl/pagina-slug etc
in a site with Bolt translate?

And should it be done in the same location in routing.yml?

[RFC] Simple language alternator

Most of the multilingual websites I made use only 2 languages, so it's kinda overkill to present a whole dropdown menu just to switch between the two. It would be nice to have a simple link that changes depending on the current language.

Here's my approach for _localeswitcher.twig:

{% for iso, locale in locales %}
    {% if app.request.get('slug') and app.request.get('_route') == 'contentlink' or app.request.get('_route') == 'pagebinding' %}
        {% set newslug = get_slug_from_locale(record, locale.slug) ?: record.slug %}
    {% else %}
        {% set newslug = app.request.get('slug') %}
    {% endif %}
    {% if locale.slug != app.request.get('_locale') %}
        <a title="{{ locale.label }}" href="{{ url(
             app.request.get('_route'),
             app.request.get('_route_params')|merge({_locale: locale.slug, slug: newslug })
             )}}">
             {{ locale.label }}
        </a>
    {% endif %}
{% endfor %}

page setup

This is a bit complex to explain, but I hope you'll bear with me. What happens is. I first have to save a new page before I can add languages. This is not bad. However, after I've saved the page the main language inherits from this saved page. This is not the issue I want you to fix, I would like you to look into the following:

Can you also make it so that the main page also inherits from the main language rather than only the other way around?

What it's currently like:

parent:{title},{body},etc
  - {main language}{title},{body},etc > inherits from parent
  - {language 2}{title},{body},etc
  - {language 2}{title},{body},etc

What I would like:

parent:{title},{body},etc < inherit from main language
  - {main language}{title},{body},etc > inherits from parent
  - {language 2}{title},{body},etc
  - {language 2}{title},{body},etc

localeswitcher suggestion

<form action="???" id='language-preferance'>
    <select class="language-list" id="language-list">
        {% for iso, locale in locales if locale.slug == app.request.get('_locale') %}
            {{_self.localeoutput(iso, locale)}}
        {% endfor %}
        {% for iso, locale in locales if locale.slug != app.request.get('_locale') %}
            {{_self.localeoutput(iso, locale)}}
        {% endfor %}
    </select>
    <input type="submit">
</form>
{% macro localeoutput(iso, locale) %}
    {% if app.request.get('slug') != '' %}
        {% set newslug = get_slug_from_locale(record, iso) ?: record.slug %}
    {% endif %}
    <option value="{{ url(app.request.get('_route'), 
            app.request.get('_route_params')|merge({_locale: locale.slug, slug: newslug })
        )}}" {% if locale.slug == app.request.get('_locale') %}selected{% endif %}>
        {{ locale.label }}
    </option>
{% endmacro %}

For usabillity preferances it may be convenient to have this type of presentation. I don't want the original one to be replaced. I just would like to add this as a suggestion. The other one is just fine as is.

As for the php part of this form. I would like to leave it up to you as I'm pretty sure you have your own ideas aswell.

Preview is broken due to _route_params?

For the preview route we use a query string to set the locale, so _route_params won't work there IIRC.

Introduced in #38, Self-assigning :)

Details

  • Translate Version: master
  • Install type: Extension Repository
  • Bolt Version: master

[BUG] Doesn't save data on repeater fields

I got a website that use repeater fields a lot. I tried to configure my contenttypes.yml like this:

repeater:
    type: repeater
    is_translateable: true
    fields:
        repeattitle:
            type: text
            is_translateable: true

Maybe I'ts not supported but I couldn't find anything in the docs.

Thanks for keeping this plugin so great, cheer mate!

[RFC] Fallback on missing content

There have been suggestions regarding this by @Puddingboy and @evertalbers in #16. I have the feeling, that this is a longer topic, so I'm moving it here.

Currently, when creating a new record for a translatable contenttype, fields can only be populated for the default locale. Other locales are populated empty. (Am I right in assuming this, @SahAssar?)
At this point, if the website is opened in frontend with other than the default locale, the page is shown without values.

Here's my take on this:

At some point, someone will request, to be able to create a record in other than the default locale. And leave the default one empty. I'm not sure, if we should support this, as it makes the whole fallback thing even more complicated.

Also, if this is possible, we should make the Status field of a content type translatable by default for translatable contenttypes. This would allow an editor to decide, when content is ready to be published.

Then regarding fallback, there are a couple of strategies, on how to handle this. From the top of my head:

  • Fallback to default locale, if field is empty
  • Fallback to default locale record, if fields are empty
  • Still show the empty values
  • Show a 404 or redirect to startpage
  • Show a message (i.e. Not translation available, switch to [link to default locale])

Real live example

I have a website, that also features translatable blog posts (DE as default, EN). Every post will first be written in german and then eventually translated.

The best possible outcome in my opinion would be to show the german content as long as the translation is missing. Maybe, show a little message on top, that this is not available in english atm.
It would behave this way, as long, as the Status for this language is not set to Published.

Please feel free to discuss and also bring your arguments from #16 again.

[BUG] MySQL Exception: Specified key was too long

Details

  • Translate Version: [ 3.1.0 ]
  • Install type: [ Extension Repository ]
  • Bolt Version: [ 3.0.11 ]
  • PHP version: [ 5.5.38 ]
    • MySQL version: [ 5.6.20 MySQL Community Server (GPL) ]
  • Used webserver: [ Apache ]

Reproduction

It seems that when I try to update my DB after the extension installation, MySQL throws and exception related to the INDEX CREATION.

This is the exception - SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

Here's an screenshot

captura de pantalla 2016-08-02 a las 2 50 39 p m

Problem with installation (bolt-translate extension)

Hello.
I want to use the Translation plugin in my BOLT project.

I setup bolt-translate extension and done steps from "read me".

I dont understand # 8 step (Translate your boltforms by adding {% set form = translate_form(form) %} at the top of a form template. This requires the labels extension. (the current solution is very hacky, WIP)) and # 9 step (If you use the menueditor extension it will automatically add fields for translated labels, use these by adding {{ item[app.request.get('_locale')~'label'] ?: item.label|default('-') }} in your menu template.)

In what files I need to write down the code, in order to get "select the languages" in the form of creating / editing the contenttype entityes (as in your example - https://cloud.githubusercontent.com/assets/343392/10799822/23900e48-7daf-11e5-86ad-c7f7730a0b13.png) ?

Page creation issue

I notice that creating a page, sometimes previous content fills the page. Please note: I first prefilled the page with dummy content using the fill option.

Now after deleting a truckload of pages, previously removed content shows up on the page id's of freshly created pages. page ID1 which should be filled with the title Nieuws shows up on the page as Istam.... asdf something. The same goes for my empty body, which is now filled with this previously removed content.

Any idea what is going on? Did you do any updates I haven't used yet?
*edit: even after clearing cache and updating extenstion files, the issue remains.

To clarify: Old content shows up on the frontend, yet new content exists within the adminpanel. I believe content is not fetched or refreshed properly. I am also having errors after attempting to bulk remove pages. If I do. I get sent to an errorpage. After returning the the adminpanel only the first selected page gets removed.

[BUG] LocalizedMenuBuilder references to missing Lib::path

LocalizedMenuBuilder references to missing function Lib::path, when using menu items with route: instead of path:.

Details

  • Translate Version: master
  • Install type: Extension Repository
  • Bolt Version: 3.0.11
  • PHP version: 5.5
  • Used webserver: Nginx version 1.4.6

Reproduction

  1. Use menu link with route:, e.g.

    - label: Pages
      route: contentlisting
      param:
        contenttypeslug: pages
    
  2. Open the frontend.

  3. Error message: PHP message: PHP Fatal error: Class 'Bolt\Extension\Animal\Translate\Frontend\Lib' not found in /<path>/extensions/vendor/animal/translate/src/Frontend/LocalizedMenuBuilder.php on line 46

[BUG] Template "twig/boltforms_theme_translated.twig" is not defined

Details

  • Translate Version: [ 2.0 ]
  • Install type: [ Extension Repository ]
  • Bolt Version: [ 3.0.12 ]
  • PHP version: [ 5.6 ]
  • Used webserver: [ Apache ] version [ version ]

Reproduction

When trying to render the translated forms I get this error:

Twig_Error_Loader thrown with message "Template "twig/boltforms_theme_translated.twig" is not defined in "partials/_boltforms_form.twig" at line 36."

Stacktrace:
#46 Twig_Error_Loader in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Loader/Chain.php:115
#45 Twig_Loader_Chain:getCacheKey in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Environment.php:312
#44 Twig_Environment:getTemplateClass in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Environment.php:378
#43 Twig_Environment:loadTemplate in /Users/zomars/Sites/nami/vendor/symfony/twig-bridge/Form/TwigRendererEngine.php:155
#42 Symfony\Bridge\Twig\Form\TwigRendererEngine:loadResourcesFromTheme in /Users/zomars/Sites/nami/vendor/symfony/twig-bridge/Form/TwigRendererEngine.php:102
#41 Symfony\Bridge\Twig\Form\TwigRendererEngine:loadResourceForBlockName in /Users/zomars/Sites/nami/vendor/symfony/form/AbstractRendererEngine.php:81
#40 Symfony\Component\Form\AbstractRendererEngine:getResourceForBlockName in /Users/zomars/Sites/nami/vendor/symfony/form/FormRenderer.php:108
#39 Symfony\Component\Form\FormRenderer:renderBlock in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Environment.php:403
#38 __TwigTemplate_4cacc5a29555d959963c36c0353e2850bc4b660f4dfebcf9bc1ce23fc00b744a:doDisplay in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:387
#37 Twig_Template:displayWithErrorHandling in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:355
#36 Twig_Template:display in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:366
#35 Twig_Template:render in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Environment.php:347
#34 Twig_Environment:render in /Users/zomars/Sites/nami/extensions/vendor/bolt/boltforms/src/BoltForms.php:139
#33 Bolt\Extension\Bolt\BoltForms\BoltForms:renderForm in /Users/zomars/Sites/nami/extensions/vendor/bolt/boltforms/src/Twig/BoltFormsExtension.php:131
#32 Bolt\Extension\Bolt\BoltForms\Twig\BoltFormsExtension:twigBoltForms in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Environment.php:403
#31 call_user_func_array in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Environment.php:403
#30 __TwigTemplate_be8af4e0ccea7e2bdbc8f0fb8bae7deff7e5d3acfeddc7476a219117c1b36ebf:doDisplay in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:387
#29 Twig_Template:displayWithErrorHandling in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:355
#28 Twig_Template:display in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:366
#27 Twig_Template:render in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Extension/Core.php:1463
#26 twig_include in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Environment.php:403
#25 __TwigTemplate_0bbeceec32f48186b67c15494012cedb948e2eb1ea9e277b4132a4f22625b25c:block_main in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:167
#24 Twig_Template:displayBlock in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Environment.php:403
#23 __TwigTemplate_caa13d4d91b703423128bc0131cc9cfdaa36851299aa363f4fccd12e51206788:block_body in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:167
#22 Twig_Template:displayBlock in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Environment.php:403
#21 __TwigTemplate_caa13d4d91b703423128bc0131cc9cfdaa36851299aa363f4fccd12e51206788:doDisplay in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:387
#20 Twig_Template:displayWithErrorHandling in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:355
#19 Twig_Template:display in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Environment.php:403
#18 __TwigTemplate_0bbeceec32f48186b67c15494012cedb948e2eb1ea9e277b4132a4f22625b25c:doDisplay in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:387
#17 Twig_Template:displayWithErrorHandling in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:355
#16 Twig_Template:display in /Users/zomars/Sites/nami/vendor/twig/twig/lib/Twig/Template.php:366
#15 Twig_Template:render in /Users/zomars/Sites/nami/vendor/bolt/bolt/src/Response/BoltResponse.php:198
#14 Bolt\Response\BoltResponse:compile in /Users/zomars/Sites/nami/vendor/bolt/bolt/src/Response/BoltResponse.php:174
#13 Bolt\Response\BoltResponse:getContent in /Users/zomars/Sites/nami/vendor/symfony/http-kernel/HttpCache/Esi.php:131
#12 Symfony\Component\HttpKernel\HttpCache\Esi:addSurrogateControl in /Users/zomars/Sites/nami/vendor/symfony/http-kernel/EventListener/SurrogateListener.php:49
#11 Symfony\Component\HttpKernel\EventListener\SurrogateListener:onKernelResponse in /Users/zomars/Sites/nami/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:61
#10 call_user_func in /Users/zomars/Sites/nami/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:61
#9 Symfony\Component\EventDispatcher\Debug\WrappedListener:__invoke in /Users/zomars/Sites/nami/vendor/symfony/event-dispatcher/EventDispatcher.php:184
#8 call_user_func in /Users/zomars/Sites/nami/vendor/symfony/event-dispatcher/EventDispatcher.php:184
#7 Symfony\Component\EventDispatcher\EventDispatcher:doDispatch in /Users/zomars/Sites/nami/vendor/symfony/event-dispatcher/EventDispatcher.php:46
#6 Symfony\Component\EventDispatcher\EventDispatcher:dispatch in /Users/zomars/Sites/nami/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:140
#5 Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher:dispatch in /Users/zomars/Sites/nami/vendor/symfony/http-kernel/HttpKernel.php:184
#4 Symfony\Component\HttpKernel\HttpKernel:filterResponse in /Users/zomars/Sites/nami/vendor/symfony/http-kernel/HttpKernel.php:166
#3 Symfony\Component\HttpKernel\HttpKernel:handleRaw in /Users/zomars/Sites/nami/vendor/symfony/http-kernel/HttpKernel.php:64
#2 Symfony\Component\HttpKernel\HttpKernel:handle in /Users/zomars/Sites/nami/vendor/silex/silex/src/Silex/Application.php:586
#1 Silex\Application:handle in /Users/zomars/Sites/nami/vendor/silex/silex/src/Silex/Application.php:563
#0 Silex\Application:run in /Users/zomars/Sites/nami/public_html/index.php:14

[RFC] Wish/todolist for the extension

So I thought i'd start a wishlist of features that I want to implement, these are the ones I can think of right now:

  • Check that we can support all extensions that add fields (currently it should work with gridview, SEO, colorpicker and iconpicker)
  • Better and more thorough documentation
  • Unit tests
  • Proper lang headers/html attrib
  • rel="alternate" links in head
  • Add require_slugs option to only show records that have a translated field (or perhaps something like required_fields: [title, body])
  • Allow records to exist in only a non-default language (Currently all records must exist in the default language before being translated)
  • Automatic configuration of the labels extension (setup the correct locales and default locale)
  • Automatic translation of boltforms, including #15 (?)
  • Add option to fallback to using serverside requests to the google translate API to translate untranslated fields
  • Integrate with bolt's search to allow localebased searching
  • Allow imagelist and image fields to be set to translate title/alt only without having to reselect images

Ping @madc and @Puddingboy for additions

[RFC] Hide slug for default locale (in routes/links)

Personally, I'm a huge fan of simple URLs. Thats why i propose, that we introduce an option to hide the slug of the default locale. That means, that instead of mysite.com/de and mysite.com/en, we would have mysite.comand mysite.com/en, if german is the default language.

After giving this just a quick thought, I can come up with two ways to solve this (from user perspective):

  • Add an option to the config (i.e. hide_default_slug: [true/false])
  • Allow to set an empty slug for one language in the locales config

What do you thinkt, @SahAssar?

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.