Giter VIP home page Giter VIP logo

Comments (7)

kkomelin avatar kkomelin commented on May 29, 2024

Hey @marijnkampf,

Thanks for the proposal. I like the second idea with the config option more.
But before we spend time on developing anything, let's answer a few questions:

  1. We probably need a particular example where this feature is applicable. Could you please provide it?
  2. Did you try "\n" control symbol to make a new line inside a translatable string?
  3. What do you think about HEREDOC and NOWADOC? We're currently not supporting them.
  4. Some people may still use __("translation.keys"). As I know, translation keys can't contain white spaces or new lines. Will your proposed change affect those developers' normal workflow?

Thanks.

from laravel-translatable-string-exporter.

marijnkampf avatar marijnkampf commented on May 29, 2024
  1. I'm using Markdown in some translatable labels to allow for emphasis. So an example would be:
    __("# Hello world

Welcome to *Thunderdome*")

  1. That would probably work, but would result in less readable text to translate.

  2. This would require some significant changes in the regular expression used to matching strings.

  3. No it won't affect keys without spaces or new lines.

from laravel-translatable-string-exporter.

kkomelin avatar kkomelin commented on May 29, 2024

@marijnkampf Thanks for your answers. Now I understand your situation better.

The simplest solution in your case is to split the line into two because they have different meaning/purpose. And, in fact, in the resulting JSON, your line break would be "\n" or "\n\n".

Also, I would encourage you to try to avoid any markup/markdown markers/tags in your translatable strings because the translator doesn't have to be familiar with the programming languages or tags. From my experience, any markup in the strings leads to not closing tags or skipping the markup completely by translators.

from laravel-translatable-string-exporter.

marijnkampf avatar marijnkampf commented on May 29, 2024

The simplest solution in your case is to split the line into two because they have different meaning/purpose. And, in fact, in the resulting JSON, your line break would be "\n" or "\n\n".

That would be a work around but my source code will be more readable without them.

If I create a pull request for an new-lines option are you happy to merge it?

from laravel-translatable-string-exporter.

kkomelin avatar kkomelin commented on May 29, 2024

That would be a work around but my source code will be more readable without them.

I would put big multiline text fragments into a database/files and fetch them depending on the selected language. Modern cache solutions can make such change almost not noticeable for end-user. But it's up to you.

If I create a pull request for an new-lines option are you happy to merge it?

Of course, go ahead. Just keep current user settings unchanged. And please add an automated test for it.

from laravel-translatable-string-exporter.

kkomelin avatar kkomelin commented on May 29, 2024

@marijnkampf Just released https://github.com/kkomelin/laravel-translatable-string-exporter/releases/tag/1.9.0 Please test it.

from laravel-translatable-string-exporter.

marijnkampf avatar marijnkampf commented on May 29, 2024

@marijnkampf Just released https://github.com/kkomelin/laravel-translatable-string-exporter/releases/tag/1.9.0 Please test it.

It's all working. Thanks!

from laravel-translatable-string-exporter.

Related Issues (20)

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.