Translated text is not displayed, but saved

Hello,

I use 3 languages in panel: de, fr and it. if I enter and save a text in the default language and then switch to another language and translate and save it there. if I then switch to another language and return again, the text default is displayed. however, it is saved correctly in .txt.

I don’t understand what I’m doing wrong.

blueprint

    title: Page
    preset: page
    pages: false


    options:
      preview: false
      changeTemplate: false
      read:
        admin: true
        member: false

    fields:
      text:
        label: Text
        type: textarea

config

    <?php

    return [
        'debug' => true,
        'panel.install'=> true,
        'languages' => true,

      'community.markdown-field.buttons'    => ['headlines', 'bold', 'italic', 'divider', 'link', 'email', 'pagelink', 'file', 'divider', 'ul', 'ol'],
      'community.markdown-field.font'       => [
        'family'  => 'sans-serif',
        'scaling' => false,
        'size'    => 'regular',
      ],

      'community.markdown-field.modals'     => true,
      'community.markdown-field.blank'      => false,
      'community.markdown-field.invisibles' => false,


      'thumbs' => [
        'driver' => 'gd',
        'autoOrient' => true
      ],

     
        'routes' => [
          [
            'pattern' => 'mitglied/(:any)',
            'action'  => function($user) {
              $site = kirby()->site(); 	
              return tpl::load(kirby()->roots()->templates() . DS . 'member.php', array('user' => $user, 'site' => $site), false);
            }
          ]
          ],
      
      



        'hooks' => [
          'route:before' => function ($route, $path, $method) {
         

            if (Str::startsWith($path, 'api/pages') && $method == 'GET') {

              $pagePath = str_replace('+', '/', str_replace('pages/', '', $route->arguments()[0]));

              $page = kirby()->page($pagePath);
              $user = kirby()->user();

            if ($page && $user && $page->created()->toUser()) {
              
              if($user->username() == "Admin")
              {
                return;
              }
              
              if ($user !== $page->created()->toUser()) 
              {
                  throw new Exception('You cannot access this page');
              }
             
            }
          
          }
        }
           
        
      ]
    ];

I cannot reproduce this behavior in a 3.3.6 Starterkit. Please test if this also happens in your environment with a fresh Starterkit.

Which Kirby version are you using?
Which PHP version?
Server? Caching? Plugins? etc…

Please check that ALL content text files have a language abbreviation in the filename,
e.g. β€œsite.de.txt” but no β€œsite.txt” and β€œdefault.de.txt” but no β€œdefault.txt”.

This also applies to all file-related content text files,
e.g. β€œpicture.jpg.de.txt” but no β€œpicture.jpg.txt”.

@HeinerEF the filenames are all correct

I tested it locally with:

I use these plugins:

β”œβ”€β”€ auto-orient-images
β”‚   β”œβ”€β”€ auto-orient-images.php
β”‚   β”œβ”€β”€ changelog.md
β”‚   β”œβ”€β”€ package.json
β”‚   └── readme.md
β”œβ”€β”€ heineref_twoPanelLinks
β”‚   β”œβ”€β”€ index.css
β”‚   β”œβ”€β”€ index.js
β”‚   β”œβ”€β”€ index.min.css
β”‚   └── index.php
β”œβ”€β”€ kirby3-xmlsitemap
β”‚   β”œβ”€β”€ assets
β”‚   β”‚   └── xmlsitemap.xsl
β”‚   β”œβ”€β”€ CHANGELOG
β”‚   β”œβ”€β”€ composer.json
β”‚   β”œβ”€β”€ composer.lock
β”‚   β”œβ”€β”€ index.php
β”‚   β”œβ”€β”€ README.md
β”‚   β”œβ”€β”€ src
β”‚   β”‚   β”œβ”€β”€ config.php
β”‚   β”‚   └── xmlsitemap.php
β”‚   └── vendor
β”‚       β”œβ”€β”€ autoload.php
β”‚       └── composer
β”‚           β”œβ”€β”€ autoload_classmap.php
β”‚           β”œβ”€β”€ autoload_namespaces.php
β”‚           β”œβ”€β”€ autoload_psr4.php
β”‚           β”œβ”€β”€ autoload_real.php
β”‚           β”œβ”€β”€ autoload_static.php
β”‚           └── ClassLoader.php
└── markdown-field
    β”œβ”€β”€ composer.json
    β”œβ”€β”€ config.php
    β”œβ”€β”€ gulpfile.js
    β”œβ”€β”€ index.css
    β”œβ”€β”€ index.js
    β”œβ”€β”€ index.php
    β”œβ”€β”€ kirby-markdown-field-master
    β”‚   β”œβ”€β”€ composer.json
    β”‚   β”œβ”€β”€ index.css
    β”‚   β”œβ”€β”€ index.js
    β”‚   β”œβ”€β”€ index.php
    β”‚   β”œβ”€β”€ lib
    β”‚   β”‚   β”œβ”€β”€ fields
    β”‚   β”‚   β”‚   └── markdown.php
    β”‚   β”‚   └── languages
    β”‚   β”‚       β”œβ”€β”€ de.php
    β”‚   β”‚       β”œβ”€β”€ en.php
    β”‚   β”‚       └── fr.php
    β”‚   β”œβ”€β”€ LICENSE
    β”‚   β”œβ”€β”€ package.json
    β”‚   β”œβ”€β”€ README.md
    β”‚   └── src
    β”‚       β”œβ”€β”€ addon
    β”‚       β”‚   └── show-invisibles.js
    β”‚       β”œβ”€β”€ assets
    β”‚       β”‚   β”œβ”€β”€ css
    β”‚       β”‚   β”‚   β”œβ”€β”€ abstracts
    β”‚       β”‚   β”‚   β”‚   └── _variables.scss
    β”‚       β”‚   β”‚   β”œβ”€β”€ field
    β”‚       β”‚   β”‚   β”‚   └── _markdown-field.scss
    β”‚       β”‚   β”‚   β”œβ”€β”€ styles.scss
    β”‚       β”‚   β”‚   └── themes
    β”‚       β”‚   β”‚       β”œβ”€β”€ _custom.scss
    β”‚       β”‚   β”‚       β”œβ”€β”€ _default.scss
    β”‚       β”‚   β”‚       └── _options.scss
    β”‚       β”‚   β”œβ”€β”€ icons
    β”‚       β”‚   β”‚   β”œβ”€β”€ exports
    β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ attachment.svg
    β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ footnote.svg
    β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ h1.svg
    β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ h2.svg
    β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ h3.svg
    β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ h4.svg
    β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ h5.svg
    β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ h6.svg
    β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ horizontal-rule.svg
    β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ horizontal-rule-v2.svg
    β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ pagelink.svg
    β”‚       β”‚   β”‚   β”‚   └── strikethrough.svg
    β”‚       β”‚   β”‚   β”œβ”€β”€ icons.ai
    β”‚       β”‚   β”‚   └── icons.js
    β”‚       β”‚   └── images
    β”‚       β”‚       β”œβ”€β”€ emptyline.svg
    β”‚       β”‚       β”œβ”€β”€ newline.svg
    β”‚       β”‚       β”œβ”€β”€ tab.sketch
    β”‚       β”‚       └── tab.svg
    β”‚       β”œβ”€β”€ components
    β”‚       β”‚   β”œβ”€β”€ field
    β”‚       β”‚   β”‚   └── Markdown.vue
    β”‚       β”‚   β”œβ”€β”€ input
    β”‚       β”‚   β”‚   └── MarkdownInput.vue
    β”‚       β”‚   └── toolbar
    β”‚       β”‚       β”œβ”€β”€ buttons
    β”‚       β”‚       β”‚   β”œβ”€β”€ blockquote.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ bold.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ button.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ code.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ divider.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ email.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ file.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ footnote.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ headlines.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ horizontal-rule.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ image.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ invisibles.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ italic.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ link.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ ol.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ pagelink.vue
    β”‚       β”‚       β”‚   β”œβ”€β”€ strikethrough.vue
    β”‚       β”‚       β”‚   └── ul.vue
    β”‚       β”‚       β”œβ”€β”€ dialogs
    β”‚       β”‚       β”‚   β”œβ”€β”€ email-dialog.vue
    β”‚       β”‚       β”‚   └── link-dialog.vue
    β”‚       β”‚       └── MarkdownToolbar.vue
    β”‚       β”œβ”€β”€ index.js
    β”‚       └── modes
    β”‚           β”œβ”€β”€ kirbytext.js
    β”‚           └── markdownextended.js
    β”œβ”€β”€ lib
    β”‚   β”œβ”€β”€ fields
    β”‚   β”‚   └── markdown.php
    β”‚   └── languages
    β”‚       β”œβ”€β”€ de.php
    β”‚       β”œβ”€β”€ en.php
    β”‚       └── fr.php
    β”œβ”€β”€ LICENSE
    β”œβ”€β”€ package.json
    β”œβ”€β”€ package-lock.json
    β”œβ”€β”€ README.md
    β”œβ”€β”€ src
    β”‚   β”œβ”€β”€ addon
    β”‚   β”‚   └── show-invisibles.js
    β”‚   β”œβ”€β”€ assets
    β”‚   β”‚   β”œβ”€β”€ css
    β”‚   β”‚   β”‚   β”œβ”€β”€ abstracts
    β”‚   β”‚   β”‚   β”‚   └── _variables.scss
    β”‚   β”‚   β”‚   β”œβ”€β”€ field
    β”‚   β”‚   β”‚   β”‚   └── _markdown-field.scss
    β”‚   β”‚   β”‚   β”œβ”€β”€ styles.scss
    β”‚   β”‚   β”‚   └── themes
    β”‚   β”‚   β”‚       β”œβ”€β”€ _custom.scss
    β”‚   β”‚   β”‚       β”œβ”€β”€ _default.scss
    β”‚   β”‚   β”‚       └── _options.scss
    β”‚   β”‚   β”œβ”€β”€ icons
    β”‚   β”‚   β”‚   β”œβ”€β”€ exports
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ attachment.svg
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ h1.svg
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ h2.svg
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ h3.svg
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ h4.svg
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ h5.svg
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ h6.svg
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ horizontal-rule.svg
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ horizontal-rule-v2.svg
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ pagelink.svg
    β”‚   β”‚   β”‚   β”‚   └── strikethrough.svg
    β”‚   β”‚   β”‚   β”œβ”€β”€ icons.ai
    β”‚   β”‚   β”‚   └── icons.js
    β”‚   β”‚   └── images
    β”‚   β”‚       β”œβ”€β”€ emptyline.svg
    β”‚   β”‚       β”œβ”€β”€ newline.svg
    β”‚   β”‚       β”œβ”€β”€ tab.sketch
    β”‚   β”‚       └── tab.svg
    β”‚   β”œβ”€β”€ components
    β”‚   β”‚   β”œβ”€β”€ field
    β”‚   β”‚   β”‚   └── Markdown.vue
    β”‚   β”‚   β”œβ”€β”€ input
    β”‚   β”‚   β”‚   └── MarkdownInput.vue
    β”‚   β”‚   └── toolbar
    β”‚   β”‚       β”œβ”€β”€ buttons
    β”‚   β”‚       β”‚   β”œβ”€β”€ blockquote.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ bold.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ button.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ code.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ divider.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ email.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ file.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ headlines.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ horizontal-rule.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ image.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ invisibles.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ italic.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ link.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ ol.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ pagelink.vue
    β”‚   β”‚       β”‚   β”œβ”€β”€ strikethrough.vue
    β”‚   β”‚       β”‚   └── ul.vue
    β”‚   β”‚       β”œβ”€β”€ dialogs
    β”‚   β”‚       β”‚   β”œβ”€β”€ email-dialog.vue
    β”‚   β”‚       β”‚   └── link-dialog.vue
    β”‚   β”‚       └── MarkdownToolbar.vue
    β”‚   β”œβ”€β”€ main.js
    β”‚   └── modes
    β”‚       β”œβ”€β”€ kirbytext.js
    β”‚       └── markdownextended.js
    └── vendor
        β”œβ”€β”€ autoload.php
        └── composer
            β”œβ”€β”€ autoload_classmap.php
            β”œβ”€β”€ autoload_files.php
            β”œβ”€β”€ autoload_namespaces.php
            β”œβ”€β”€ autoload_psr4.php
            β”œβ”€β”€ autoload_real.php
            β”œβ”€β”€ autoload_static.php
            β”œβ”€β”€ ClassLoader.php
            β”œβ”€β”€ installed.json
            └── LICENSE

Unfortunately, you didn’t answer all my questions…

PHP 7.4.3
Kirby 3.3.6
How do I know if I’m using caching?

my kirby update script:

     #!/bin/sh
        sudo rm -rfv kirby
        git clone https://github.com/getkirby/kirby/
        cd "$(dirname "$0")/kirby"
        rm -rf .git exit;

Have you tested with a fresh Starterkit as I suggested above?

yes, it works.

look like this part in my config produce the error:

'hooks' => [
  'route:before' => function ($route, $path, $method) {
 

    if (Str::startsWith($path, 'api/pages') && $method == 'GET') {

      $pagePath = str_replace('+', '/', str_replace('pages/', '', $route->arguments()[0]));

      $page = kirby()->page($pagePath);
      $user = kirby()->user();

    if ($page && $user && $page->created()->toUser()) {
      
      if($user->username() == "Admin")
      {
        return;
      }
      
      if ($user !== $page->created()->toUser()) 
      {
          throw new Exception('You cannot access this page');
      }
     
    }
  
  }
}
   
  ]

This hook should not return anything.

You can modify it like this:

   'hooks' => [
        'route:before' => function ($route, $path, $method) {
       
      
          if (Str::startsWith($path, 'api/pages') && $method == 'GET') {
      
            $pagePath = str_replace('+', '/', str_replace('pages/', '', $route->arguments()[0]));
      
            $page = kirby()->page($pagePath);
            $user = kirby()->user();
      
            
            
            
            if ($page && $user && $user->role()->name() !== 'admin' && $user !== $page->created()->toUser()) 
            {
                throw new Exception('You cannot access this page');
            }
 
        
        }
      }
         
    ]

On a side note: Please always use three backticks on a separate line before and after a code block. Otherwise your code is hard to read when messed up. Thank you. I corrected your code above, so you can check out what it should look like by clicking on the edit button.

1 Like

:partying_face: :pray:

Thank you @texnixe