Code Monkey home page Code Monkey logo

kirby-content-translator's Introduction

Visit my link tree

Visit my website

Visit my Instagram

Hi, I’m Johann. I work somewhere in between development and design β€”
A JavaScript one-trick pony with an aesthetic sense.

Projects

My current focus is on the Nuxt and Vue development experience.

Multi-Framework

  • unlazy: πŸͺ§ Universal lazy loading library for placeholder images leveraging native browser APIs

Nuxt.js & Vue.js

  • @nuxtjs/plausible: 🎟️ Plausible Analytics integration for Nuxt
  • nuxt-api-party: 🐬 Securely connect to any API with a server proxy and generated composables
  • nuxt-prepare: 🦎 Build actions for Nuxt
  • nuxt-lcp-speedup: πŸͺΏ Instantly better LCP scores in Google Lighthouse
  • nuxt-kql: 🫧 Kirby's Query Language API for Nuxt
  • nuxt-gtag: πŸ”Έ Google Analytics & Ads integration made easy
  • vue-stickers: 🍦 One component, multiple fancy sticker variants
  • @byjohann/vue-i18n: 🌐 Lightweight internationalization plugin for Vue

Tooling

  • @unocss/cli: 🎨 The CLI for UnoCSS. A perfect fit for traditional backends.
  • nitro-test-utils: πŸ§ͺ Testing environment and utilities for Nitro
  • pdfjs-serverless: πŸͺ­ Serverless build of PDF.js for Deno, workers, and other nodeless environments
  • kirbyup: πŸ†™ Official bundler for Kirby Panel plugins
  • kirbyuse: πŸŽ›οΈ Collection of Vue Composition utilities and typed window.panel for Kirby CMS

Libraries

  • unpdf: πŸ“„ Utilities to work with PDFs in Node.js, browser and workers
  • tokenwise: πŸ“ GPT token estimation and context size utilities without a full tokenizer
  • apiverse: ✴️ Unified, pluggable API client management for ofetch, route building and typed OpenAPI clients

Demos / Templates / App Starters

Kirby Plugins

Commercial

Open Source

kirby-content-translator's People

Contributors

chrfickinger avatar johannschopplich 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

Watchers

 avatar  avatar

kirby-content-translator's Issues

Add support for layout fields

Thanks for the great plugin! Unfortunately it doesn't work for layout fields with type: layout.
Can you fix that?

Error on translate

Hi, I encounter an error when I click on the translate button. I've try on a plain kit clean install, with two languages and a simple textarea field… Sync works, but when I click translate I get an error message.

In the console tab, of the browser, a message appears when I click

index.js?1714369334:1

TypeError: Cannot read properties of undefined (reading 'text')
    at index.js?1714369334:1:2393
    at async Promise.all (:8888/deepl/panel/pages/index 0)
    at async I (index.js?1714369334:1:2982)
    at async recursiveTranslateContent (index.js?1714369334:1:2850)
    at async Object.H (index.js?1714369334:1:5466)

The message error is not very helpful, so I'm quite stuck…

image

Any Idea ?
Thanks

Lrt

--
Kirby 4.2.0
Php 8.1.13

Blocks field inside of custom block throws error when translating

When adding a custom block type via translatableBlocks that contains a blocks field itself, an error is thrown during translation.

This is my custom block called toggle.yml.

name: Toggle
fields:
  label:
    type: text
  blocks:
    type: blocks
    fieldsets:
      - heading
      - text

Adding it to my translatableBlocks will throw an error when translating. When removing the blocks field reference, the label is translated correctly and no error is thrown.

translatableBlocks:
  toggle:
  - label
  - blocks

I am getting: TypeError: u.result is undefined.

I am getting this error, did probably the api from deepl change from 'result' to 'text' ?

Screenshot 2024-05-12 at 18 24 16

The translation works, it seems that the wrong key is read from the response. Or am i missing something?

Translate content programmatically

Hi Johann.

Does this plugin expose any methods for translating content programmatically? I am in the process of converting a client's site that has had only one language for several years into a multi-lingual site. There is a lot of content that needs to be translated and having a way to do it programmatically would be incredibly helpful.
Using your plugin, could I somehow iterate over a pages collection and call something like a $page->translate() function?

Option to update slug after translating title

This would be a great addition. Maybe as on opt-in config option?
I know automatically updating a page's slug isn't always optimal, but I believe many of my clients will not realize that they would need to do this manually after pressing the translate button. I have solved it with a simple page.changeTitle:after hook for now.

Translation of nested blocks

Hi Johann
This plugin is really fantastic. Great work! It speeds up my workflow immensely. Are there any plans to translate "nested blocks" as well? I use these very often in my projects, e.g. for FAQs or lists. If this sounds interesting, I could provide you with the necessary information and also help with testing.

Best regards
Christian

Translate page titles besides content

Hello,

I've noticed that it doesn't support the translation of page titles.

This is an essential feature for a multilingual site, as page titles are crucial for both SEO and providing a localized user experience. I attempted several methods, including trying different hooks and methods as suggested in the Kirby documentation, but without success.

Could this functionality be added in a future update?

Thank you for the great work on this plugin.

Best regards,
Jiri

Structure field in block

Hi and thanks creating this plugin.

I noticed that it currently doesn't work yet with blocks who contain structure fields. For example one might define a custom block like so:

name: myblock
wysiwyg: true
preview: fields
fields:
  items:
    label: Items
    type: structure
    fields:
      title:
        label: Title
        type: text
      text:
        label: Text
        type: text

As is the plugin would not be able to translate this block. To fix that i have written a small patch for your code. The code might not be ideal yet, but it could be a starting point for you to develop an even better solution. You can see it in the linked Pull Request

With this patch one would define the translatable fields in the structure of the block as follows:

'johannschopplich.content-translator' => [
    'translatableFields' => ['blocks'],
    'translatableBlocks' => [
        'myblock' => [
            'items' => ['title', 'text']
        ],
    ],
],

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.