question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Fake field and translations

See original GitHub issue

I wonder about translatable and the fake field functionality. Currently to create a translatable fake field you have to mark the entire column as translatable. This makes it impossible for a fake column to contain both translated and untranslated content. For example SEO/OpenGraph meta information: meta_title,meta_description and meta_keywords should all be translatable, but meta_image is (almost always) the same for any language. From a practical standpoint (also looking at potential overhead when using a mixed translatable/non translatable fake field situation) it would be more logical if a fake field would store it’s “faked” translated information per field inside the fake column (maybe through a configuration property)… Combining this with the “withFakes” option and a slightly modified “HasTranslations” should provide enough flexibility to mix-and-match translated/untranslated fields inside a single fake column…

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
diakosavvasncommented, Dec 8, 2019

Hello guys,

This comment doesn’t work on backpack/crud 4.0.23, Laravel 6.6.0 The only think you should change is that you don’t have to cast'extras_translatable'to array. Everything else works just fine. Thank @promatik for your answer. I just mention that because it took me hours to realize that.

Cheers

1reaction
promatikcommented, Jun 26, 2017

@lloy0076 you were right, I solved it without any coding, just by adding 'extras_translatable' to $fillable, $fakeColumns and $translatable , and cast 'extras_translatable' to array.

protected $fillable = ['title', 'description', 'extras', 'extras_translatable'];
protected $fakeColumns = ['extras', 'extras_translatable'];	
protected $translatable = ['title', 'extras_translatable'];
protected $casts = ['extras_translatable' => 'array'];

Also, when adding field, store the field in extras_translatable.

$this->crud->addField([
	'fake' => true,
	'store_in' => 'extras_translatable',
	...
]);

And it’s done!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Laravel Backpack Fake fields and translations - Stack Overflow
My problem is, some fields may be translatable and others may not. Right now the only way to get translations to work in...
Read more >
Real Translation Job, or Scam? A Simple Checklist ... - TM-Town
Those scams that are designed for translators do a convincing job once you've ... They even send a tracking number for a fake...
Read more >
Fake translations? | Request PDF - ResearchGate
Request PDF | Fake translations? | I have tried to translate two simple sentences from German into English, French, Italian and Spanish.
Read more >
9 ways to recognize translation scammers - Smartcat
In this post we discuss the typical translation scam, how to tell ... Fake translators are a drain on resources—both time and money....
Read more >
Seven Unmistakable Signs That a Translation Agency Is a Fake
1. We are ISO-certified. · 2. We translate all languages and specialize in all translation fields. · 3. We don't use translators –...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found