Comments (7)
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:
- We probably need a particular example where this feature is applicable. Could you please provide it?
- Did you try "\n" control symbol to make a new line inside a translatable string?
- What do you think about HEREDOC and NOWADOC? We're currently not supporting them.
- 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.
- I'm using Markdown in some translatable labels to allow for emphasis. So an example would be:
__("# Hello world
Welcome to *Thunderdome*")
-
That would probably work, but would result in less readable text to translate.
-
This would require some significant changes in the regular expression used to matching strings.
-
No it won't affect keys without spaces or new lines.
from laravel-translatable-string-exporter.
@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.
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.
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.
@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 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)
- Support for Laravel 7 HOT 3
- Strings with quotes get truncated or escaped again HOT 3
- Strings containing round brackets are truncated improperly HOT 1
- Make it possible to exclude some folders from the search HOT 12
- It cannot handle `__('Search...')`
- Exclude short translation keys from export HOT 6
- JSON File HOT 1
- Parsing Issues still persist HOT 5
- Ability to add comments that provide enhanced features HOT 3
- Undetected strings if "key"-argument starts on new line HOT 4
- Does not support new Laravel 9 directory structure HOT 12
- Drop support for PHP 5.6 in 1.16.0 HOT 4
- Release 1.16.0 HOT 2
- require-dev instead of require ? HOT 5
- Split short-keyed translations into separate directories/files? HOT 1
- Drop support for PHP 7.4 and Laravel 5.x/6.x/7.x
- Enable `exclude-translation-keys` by default
- [feature-request] per function transformation HOT 5
- Changing export directory HOT 1
- excluded-directories does not work as expected HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-translatable-string-exporter.