Laravel gettext or native localization? [closed] - laravel

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I would like to ask what and why would be the preferred tool for localizing Laravel projects? I have already used a gettext plugin and it worked well. I like using POedit which allows translators using it without programming skills. Plus, the translation hints are cool, too.
Is there any good reason for using Laravel native localization? Or, are there any cons of using gettext?
Thanks!

Why not both: GetText and native localization?
Using GetText with source text is great for developers to work quickly and efficiently on new features without having to "make up" keys, switching files, maintaining consistency between keys and source text etc. Also, using GetText makes it easier to check if everything is translated and you don't need to worry if some keys/values are obsolete.
Using PHP trans() with keys/values is great for copywriting. It's easy for the marketing team or CEO to change the text for all languages (included the source language) without changing the code.
For these reasons, we created https://translation.io/laravel that allows you to use both syntaxes at the same time (and we suggest to only use PHP key/value when the source text needs to be editable through the translation interface).
The package is here is you need more technical info: https://github.com/translation/laravel

The native localization method is described in the Laravel documentation. You basically maintain language files for all languages you want to translate to. To pull them out of the file, you use trans(), trans_choice() (for plural) or __() helpers in Blade template.
Thats the most basic translation handling. At one level higher you might want save all translations to the database. There exists a few packages on Github which doing this. Like:
https://github.com/dimsav/laravel-translatable
https://github.com/barryvdh/laravel-translation-manager
and more. Just search for Laravel Translation.
This method only works as long as you use Blade for the frontend. If you use VueJs, Angular or React, the blade helpers won't work anymore and you have to find different ways how to handle this. This might depend on existent language handling of the aforementioned frontend framework.
I wrote an blog article about that topic.

#Peter Matisko, can you give us a little update on how did you decide, which one are you preferring to use?
Personally I tried quite a couple of different translation libraries, but gettext is still first choice for me:
extract all the translations from code and generate translation files (*.po)
translations editor that runs on Mac, Windows and Unix (Poedit initial release ~20 years ago)
translating plural forms

Related

What files and folders should I have in Laravel if Vue and Vuetify is installed? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
That may sound like an odd question so let me explain why I ask it. I am just learning Laravel, Vue and Vuetify but I haven't found a coherent set of instructions that actually works for installing them except for this video. Based on the verification steps at the end, it appears that this procedure correctly installs Vue and Vuetify in Laravel.
Unfortunately, I can't find any course on learning Vuetify in Laravel, although this playlist seems pretty clear for a non-Laravel environment. Unfortunately, the playlist's installation instructions seem to result in a very different structure for the project which bears almost no resemblance to what I see in Laravel. And that is confusing me when it comes to actually writing code.
For instance, at the start of the third video, the narrator starts to go through the first Vuetify code that he is going to teach and the files shown in his IDE are very different than what I have in Laravel. While I do have a node_modules and public folder, as he does, I've also got a bunch of other folders, like app, bootstrap, config, database, resources, storage, route, and vendor but I do not have a src folder (nor most of its subfolders, aside from views). I am also lacking an App.vue file, the one he is editing at the start of that video.
I have no idea how to proceed after many hours of searching for videos and tutorials. I am afraid that I am missing a bunch of critical files that I will need but I can't think of any way to determine what those files are nor do I know where to find them.
I am keen to proceed with learning Vuetify but I won't make any progress until I can be certain that I have all the files and folders I need to proceed.
Vue is the most unopinionated framework you have come across. It doesn't require any folder structure (node_modules is imposed by node.js, not by Vue).
So, whatever you think works best for your current project is what you should go for.
Obviously, having this type of freedom can be confusing and counter-productive, especially for those who don't know what they want or don't have much experience. Those often need to be told by more experienced others: "try this thing, it's been tested, works pretty well".
If you're looking for that type of opinionated advice/structure, give Nuxt a try. Nuxt was developed by people using Vue on a daily basis who, at some point, realized having a similar structure across projects might be beneficial and would allow for even faster prototyping.
If all you need is to be certain you're not missing anything crucial, you're not.
All you need to run Vue (and everything that's associated with it, including Vuetify) is one element's id in your page and the vue script loaded, at which point running
new Vue({ el: '#host'})
will create a Vue instance and use the element with id="host" as template.

Github use ruby on rails?

I know Github.com uses Rails.
But what template language does Github use? And what css framework does Github use?
Yes, Github uses Ruby on Rails.
When asked about the technology stack that they use to Sam Lambert, Director of technology he said:
MySQL is our core data store that we used for storing all data that powers the site as well as the metadata around the users. We also use Redis a little bit for some non-persistent caching, and things like memcached.
C, Shell, Ruby — quite a simple, monolithic stack. We’re really not an overcomplex shop, we don’t intend to try and drop new languages for every small project.
Here's a link to see the projects that power Github.
Edit
The original question was somewhat confusing and seemed to conflate Github with Rails. My answer below aimed to clarify the difference. The changes/clarifications made to the question later (after I posted my answer) have lead to the answer below to no longer respond to the question as (now) posted, but I cannot delete the answer as it has been marked as accepted...
==================================
It's hard to tell from the wording, but I think you're confused about several languages/tools that are found in Rails. Maybe this will help:
Git (http://gitscm.org/)is a version control tool (http://en.wikipedia.org/wiki/Revision_control) used frequently in Rails projects. It's used to manage the source code in your projects (versions, branches with different functions, etc.)
Github (https://github.com) is a place you can store source code that is managed with Git
the default language used in Rails views is called ERB (introduction example here: http://thinkvitamin.com/code/rails-views-erb-part-1/)
rails 3.1 uses Sass to create CSS files by default (http://sass-lang.com/)
Those are the languages you've mentioned having trouble with, and they're a portion of the languages you'll need to familiarize yourself with if you want to use Rails to its full extent.
You can learn more about Rails online (for example: http://ruby.railstutorial.org/, http://railscasts.com/), or with books (http://pragprog.com/book/rails4/agile-web-development-with-rails and http://www.manning.com/katz/ are 2 good books. The first one is easier for beginners, the second one goes into more detail and is for more advanced readers).
It appears github has moved towards converting their monolith from rails into microservices made in other languages. Doubtful rails is completely out of the picture IMHO.
https://www.theregister.com/2018/08/16/github_rails_microsoft/

Are there any command line validation tools for HTML and CSS? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Is anyone aware of command line tools that can validate CSS and/or HTML?
The W3C offers its validators for local installation, with directions to use from the command line, but the installation process is a nightmare for anyone who isn't a seasoned Java developer.
I've searched with Google, but can't find anything.
Ideally I'd like to use a tool (or tools) that I can point at my CSS, and have it report back on any errors. I want it to be local to increase the speed of my debugging cycles.
Ideally, the tools will understand HTML5 and CSS3.
There is tidy for HTML. It's more than a validator: it doesn't only check if your HTML is valid, but also tries to fix it. But you can just look at the errors and warnings and ignore the fix if you want.
I'm not sure how well it works with HTML5, but take a look at Wanted: Command line HTML5 beautifier, there are some parameter suggestions.
For CSS there is CSSTidy (I have never used it though.)
Regarding the W3C validator: if you happen to use debian/ubuntu, the package w3c-markup-validator is in the repositories and very easy to install via package management. Packages for other distos are also available.
And the W3C CSS validator is available as a jar, which is easy to use:
java -jar css-validator.jar http://www.w3.org/.
One of the most popular web-based validators is http://validator.nu.
On their About page, they list a command-line script (written in Python) for validation.
On Ubuntu, you can install the package w3c-markup-validator. It provides a CGI web interface. But you do not have to use it.
You can use my w3c-validator-runner to run the validator without having a webserver.
If that does not work, consider starting a webserver. You can then use srackham/w3c-validator.
WC3 has the source to their validators here: https://github.com/w3c
Although not directly a solution to your problem, you could consider using a CSS-extension framework for the validation part. I use SASS extensively in all my web projects and find it indispensible when you get used to it. Besides all the fancy mixins and variables features etc. it will also perform a validation of your CSS/SASS markup and report for errors as it is perfectly backwards compatible with regular CSS3. The nice thing is that it works as a Ruby Gem which means that it runs locally and can be integrated with other workflows through either Ruby or the command line (terminal in unix environment).
Take it for a spin: http://sass-lang.com/docs/yardoc/
Run sass style.scss and see what happens.
Not sure if this works but if you have Node & NPM there is: html-validator and html-validator-cli https://github.com/zrrrzzt/html-validator & https://github.com/zrrrzzt/html-validator-cli

Static site generator based upon directories & files [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 9 months ago.
Improve this question
I am looking for a nice way to generate a nested site structure in ruby. I want something that I can propose to clients instead of msword documents. Something of the form:
Home/
index.txt
About.txt
Services/
index.txt
products.txt
blahblah.txt
with the .txt files being markdown, or whatever.
I actually want to import this into a cms system, and just want to hook into whichever static-site generator that I can use.
Otherwise I will do it myself, but it would be nice to use something else for integration with html preprocessors etc.
Take a look at Jekyll
there is also middleman for generating static sites
How about either of
Ace
nanoc
webby or
StaticMatic?
The simplest of those I have seen is Stacey, though it does not run static content, it generates it on the fly, and its in PHP, but yeah it's just files and folders, even if you drop images or videos or pdf's on the folder they will be managed and added automatically. And they are just .txt files. http://www.staceyapp.com/
But, if I had to choose a static compiler in Ruby I'd go with nanoc. It's the most powerful and flexible I've seen and once you configure it with the rules and such, it's just files and folders too.
There is also Stasis, I haven't tried it but it seems pretty good.
http://stasis.me/
Here's a gist featuring the most popular ones: https://gist.github.com/2254924
Monkeyman (Scala) supports markdown and SCAML, the Scala version of SCAML. It will basically copies and transforms a folder structure, in any way you like. Without any processing it will copy the structure as is, but it has a slew of decorators that not only are able to transform the content, but also the location to anything you like.
It doesn't support compass, SASS or any of that yet (although being based on Scalate, it probably does transform coffeescript embedded into the template pages, but I haven't tried that.)
DocPad works quite well. It supports a broad range of preprocessors.
Let's check my open source static file CMS it's taken markdown or HTML files from directory structure and generates HTML files.
It's written in Nodejs (source codes) and it's very flexible - you can choose to use React, Nunjucks or plain javascript for templates

Powerful tool to generate documentation (exact requirements included) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Short version
We need a Maven Doxia alternative being able to generate good looking PDFs (at least code snippets should be properly indented and have configurable font size). Maven guys proposed maven-pdf-plugin in DOXIA-419, but it has same problems. Aforementioned DOXIA-419 has details on difficulties we've experienced with Doxia.
Detailed version
We develop a BIG product providing Java/C/C++/C#/etc API. Tens of client-customized branches are maintained/developed simultaneously.
We need a tool to facilitate automatic document generation meeting these requirements:
Include arbitrary snippets from Java/XML/etc samples.
Confluence Snippet Plugin is a good example of this feature.
Generate good looking printable documents (e.g. PDF).
Generate online documents having clickable cross-references etc (e.g. HTML).
Unattended mode (e.g. should be easy to run document generation process from Ant script).
Documentation source content (from which PDFs/etc are later generated) should be kept in a human-readable easy-to-diff format.
Documentation source content should be kept in separate files (not Java sources).
Support (Java/xml/etc) syntax highlighting.
UPDATE:
8. Windows OS compatibility.
My open source project Dexy might work for you. It's an authoring tool rather than an automatic document-generation tool, so it's not like JavaDoc which creates a whole structure automatically. Source code and document content are kept separate, syntax highlighting support is very good, document snippets are available. I use LaTeX for good looking printable documents, but you could use any other text-based format that compiled to PDF if you preferred that. Re the clickable cross references, you'd have to write HTML templates which could then be populated automatically (I'm doing so now, replacing JavaDoc on a project). You can also run live code examples and include this output in your documentation.
http://dexy.it

Resources