Vue.js Digest 🇷🇺 🇺🇸
39 subscribers
389 photos
745 links
Дайджест новостей из мира vuejs
Download Telegram
i18n style

https://dev.to/razbakov/i18n-style-48me
Style Guide


key pattern: <page>.<block>.<element>.<attribute>


camelCase for multiple words




Background

What are possible ways to map strings in JSON?
You would probably start with plain object:



{
"Login": "Login",
"Logout": "Logout",
"New post": "New post",
}


And you will create same file for each language, just changing values with translations.
But what if you decide later to change New post to Add post? You will need to change the key in all language files and in all source code files.
Alternative way is to use more abstract keys, that gives you more flexibility. For example:



{
"login": "Login",
"logout": "Logout",
"new": "New post",
}


And what if you now have another feature: Add event? You alternatives are:

1) make complex keys

2) group by meaning
Complex-word keys would be:



{
"login": "Login",
"logout": "Logout",
"newPost": "New post",
"newEvent": "New event",
}


And what if now you have a login screen, which has a title, subtitle, 2 fields and submit button?

You might do this:



{
"loginTitle": "Login",
"loginSubtitle": "Please login to continue",
"loginSubmit": "Continue",
"logout": "Logout",
"newPost": "New post",
"newEvent": "New event",
}


And what if you have a registration screen which have similar elements?



{
"loginTitle": "Login",
"loginSubtitle": "Please login to continue",
"loginSubmit": "Continue",
"registerTitle": "Registration",
"registerSubtitle": "Create new account",
"registerSubmit": "Start",
"logout": "Logout",
"newPost": "New post",
"newEvent": "New event",
}


As you see translation file grows exponentially. You can make life easier for developers and translators by grouping keys:



{
"login": {
"title": "Login",
"subtitle": "Please login to continue",
"submit": "Continue",
},
"register": {
"title": "Registration",
"subtitle": "Create new account",
"submit": "Start",
},
"logout": "Logout",
"post": {
"new": "New post"
},
"event": {
"new": "New event"
}
}


When grouping elements look for similarities, what those elements have in common and how it would scale.
Input element can have label, placeholder, error. Those are attributes of that element, so it make sense to group values by element name, i.e. in our login screen:



{
"login": {
"title": "Login",
"subtitle": "Please login to continue",
"submit": "Continue",
"username": {
"label": "Enter your username",
"placeholder": "JohnDoe",
"error": "Username is a required field",
}
},
}


But what if there are more error messages later? If we need to add error message for complexity validation (i.e. "Please use numbers, letters, special symbols"). Both are errors, so we would group them under errors.



How does this look in YML?

YML looks similar to JSON, just without curly brackets:



login:
title: Login
subtitle: Please login to continue
submit: Continue
username:
label: Enter your username
placeholder: JohnDoe
error: Username is a required field


or you can also do it per line:



login.title: Login
login.subtitle: Please login to continue
login.submit: Continue
login.username.label: Enter your username
login.username.placeholder: JohnDoe
login.username.error: Username is a required field


Last one have few benefits:

It's easier to review PRs having the whole context, and not just seeing some part of bigger object
It's easier to find string from t() function in the translations

But also you could mix up login and login.title and destroy the object without even noticing it.



More on this topic:


https://dev.to/omaiboroda/three-ways-to-name-i18n-translation-keys-2fed
https://medium.com/frontmen/web-internationalisation-i18n-lessons-ive-learned-the-hard-way-438a3e157e0
https://lokalise.com/blog/translation-keys-naming-and-organizing/
https://phrase.com/blog/posts/ruby-lessons-learned-naming-and-managing-rails-i18n-keys/
How to Use the Hover Component in Vuetify

https://javascript.plainenglish.io/how-to-use-the-hover-component-in-vuetify-7059cf8724d2?source=rss------vuejs-5
Learn how to use the hover component in Vuetify.Continue reading on JavaScript in Plain English »
What is the utility of a v-model directive?

https://dev.to/leonnimoy/what-is-the-utility-of-a-v-model-directive-coh
Definition

Looking through the documentation v-model is a directive that can be use to:
"Create a two-way binding on a form input element or a component".
Which in other words, allows you to kinda create a data relation between the data object of your component and some other component or an HTML element, like a form input.



Nice! But why is that useful?

Because allows you to make quick value updates in your component. Without the need to use states, props, or anything like that. And is a "two-way binding", allowing a great manipulation of data in your component.




Example

Let's see a quick example:

HTML:



<div id="app">
<input v-model="checkedNames" type="checkbox" id="kirk" value="John"/>
<label for="kirk"> Kirk</label>
<input v-model="checkedNames" type="checkbox" id="spock" value="Paul"/>
<label for="spock"> Spock</label>
<input v-model="checkedNames" type="checkbox" id="mcCoy" value="George"/>
<label for="mcCoy"> McCoy</label>
<input v-model="checkedNames" type="checkbox" id="uhura" value="Ringo"/>
<label for="uhura"> Uhura</label>
<br>
<span>Checked names: {{ checkedNames }}</span>
</div>


CSS:



body {
font-family: 'Bitter', serif;
}
#app {
text-align: center;
padding: 70px;
max-width: 360px;
font-size: 16px;
margin: 0 auto;
display: table;
line-height: 2em;
}
label {
padding-right: 10px;
}


JavaScript:



const App = {
data() {
return {
checkedNames: []
}
}
}
Vue.createApp(App).mount('#app')


See how in each input tag, the v-model directive manipulates the DOM and appends the value in each label, into the array. From the input to the data component object (one-way biding). And after that, send the array updated with the values to the span tag(two-way biding)?
Awesome, right?




Restrictions

As explained in the documentation, the v-model directive has its use limited to the following elements:



<input>
<select>
<textarea>
components





Acknowledgment

I'll like to thank @sarah_edo, for the great example provided in her CodePen.
Binary to Base64 Conversion

https://rohitshresthaa.medium.com/binary-to-base64-conversion-8840d677954a?source=rss------vuejs-5
Why convert into Base64 format?Continue reading on Medium »
Best Front-End Frameworks in 2022

https://artbees.medium.com/best-front-end-frameworks-in-2022-c9a6ed946b25?source=rss------vuejs-5
Front-end frameworks are instrumental in creating applications with a rich user experience.Continue reading on Medium »
MVVM nedir ? Two-way data binding nasıl işler ?

https://enisgltkn.medium.com/mvvm-nedir-two-way-data-binding-nas%C4%B1l-i%C5%9Fler-ace469f83ea9?source=rss------vuejs-5
Bir MVVM şablonunda Model, View ve ViewModal bulunur. Şablon da adını bu üçünden alır. Günümüzdeki Angular, Vue, Flutter gibi yazılım…Continue reading on Medium »
Simple Vue.js Pagination Example with Laravel

https://medium.com/techvblogs/simple-vue-js-pagination-example-with-laravel-6c1a561030c?source=rss------vuejs-5
Mar 13, 2021, Originally published at techvblogs.com ・3 min readContinue reading on TechvBlogs »
Frontend Olympics Coding Challenges

https://dev.to/devolympics/frontend-olympics-coding-challenges-16pl
Code yourself to the top on this new coding challenge!


Fight your way through several front-end challenges and get rewarded by the DevOlympics community!
Top 8 Vue.js Website Template Choices: Pros and Cons & What to Expect From the Framework?

https://medium.com/javarevisited/top-8-vue-js-website-template-choices-pros-and-cons-what-to-expect-from-the-framework-b9e1ee6a8bf2?source=rss------vuejs-5
Vue.js is a JavaScript framework that allows you to create user interfaces (UIs) and single-page apps (SPAs). Vue.js, like the finest of…Continue reading on Javarevisited »
90 days survey

https://medium.com/arctouch/90-days-survey-fda3025373ac?source=rss------vuejs-5
What it’s like to be a junior software engineer at ArcTouchContinue reading on ArcTouch »
My First 3 Months at ArcTouch

https://medium.com/arctouch/my-first-3-months-at-arctouch-d10b0037d0f3?source=rss------vuejs-5
What it’s like to be a junior software engineer at ArcTouchContinue reading on ArcTouch »
Axios Requests In VueJs

https://nikakharebava.medium.com/axios-requests-in-vuejs-e9437bae37b8?source=rss------vuejs-5
Knowing how to do Fetch API is good but knowing how to use Axios Requests is even better. This article is about that.Continue reading on Medium »
Offline Storage with IndexDB — Part 2

https://medium.com/@CryptOpenSource/offline-storage-with-indexdb-part-2-a2185ff2b1fe?source=rss------vuejs-5
Adding a Record to Your Store and Viewing that Record in the UI.Continue reading on Medium »
Vue and Storybook component scaffolding

https://medium.com/@tbusser/vue-and-storybook-component-scaffolding-50df77b8d79d?source=rss------vuejs-5
How to avoid writing boilerplate code when creating a new componentContinue reading on Medium »
Open Source Avatar Generation Website

https://dev.to/vorg/open-source-avatar-generation-website-4e6p
vue-color-avatar

Star 1.1k Watch 6 Fork 138

A front-end only avatar generation website. By swapping components around, you can build your own avatar.



Preview

https://vue-color-avatar.vercel.app



Introduction

By swapping components around, you can build your own avatar.
Features you might be interested in:

Visual component configuration bar
Randomly generate an avatar
Redo/Undo
i18n




Assets

Implementation of Avatar Illustration System by Micah Lanier. Licensed under CC BY 4.0.



Develop

This project is implemented using Vue3.



# 1. Clone project
git clone https://github.com/Codennnn/vue-color-avatar.git
# 2. Install dependencies
yarn install
# 3. Run
yarn dev





End

More interesting open source projects on VORG Open Source Magazine.
Vue vs. React: Which Framework to Use and When

https://medium.com/@cambika280/vue-vs-react-which-framework-to-use-and-when-406e57d087b0?source=rss------vuejs-5
React framework can be used over Vue for various reasons. In this blog, we discussed a highly debated topic: Vue vs. React.Continue reading on Medium »
Tutorial - Build CRUD Application using VueJS, GraphQL, and Hasura.

https://dev.to/bacancy/tutorial-build-crud-application-using-vuejs-graphql-and-hasura-56p6
Out developers are quick and efficient in their work and always find ways to get things done. So, today we come up with a new tutorial, which is about how to build CRUD application using VueJS, GraphQL, and Hasura.
Within a few days, we find out the solution and prepare the tutorial for the same for your knowledge. If you are looking to develop your CRUD app, just read still the end and get the best solutions.
Here, we need to note that GraphQL is not a DB technology. But it is a kind of query language.
First of all, Facebook developed it and used it to enhance the versatility of its applications, and later they released it as open-source.
Prerequisites

Basic knowledge of VueJS and GraphQL
VS Code or any other IDE
Familiarity with Javascript and HTML

Basic Steps to Follow

Database Set-Up using Hasura

Initial Set-Up and Installation
// apollo.js

// main.js


Implement CRUD Operation
CREATE

READ

UPDATE

DELETE


Further in the article, we have mentioned the technical commands for each of these steps. You just need to go through it to learn how to Build CRUD Application using VueJS, GraphQL, and Hasura.
Deploy and host your Vue.js application for Free with Utopiops

https://dev.to/mohsenkamrani/deploy-and-host-your-vuejs-application-for-free-with-utopiops-2ehl
As a software developer or a software development team, the most important thing for you is building quality software, shipping it and getting feedback from your customers.
Utopiops (utopiops.com) is a new player in town that aims to solve the problem uniquely by giving you a complete ecosystem that supports you entire platform from build, deployment and hosting your applications to monitoring the platform, incident reports and integrations with issue tracking systems.
Utopiops also supports Fully-managed and Managed applications. The Fully-managed applications are hosted on Utopiops cloud platform, while Managed applications are hosted on your own cloud accounts.
In his post I show you how to host your applications using Fully-managed applications on Utopiops for free.
To do so, I have used a very simple Vue.js application. You can find the application in the repository here, though nothing special about it really and you can use whatever Vue.js app you like.
Before we begin the deployment you need to create an account on Utopiops if you already haven't done that before, by registering and verifying your email.
Now we create a static website application

Then we choose the repository we have stored our code.

I'm using Github for this example, but you can also use Gitlab and Bitbucket too.

Notice that as there is no build required for this application we don't provide any build command and output path.

Right away the built-in CICD on Utopiops is set up and starts deploying your application.

And in a just few seconds your application is available (for this example it took 3 seconds to be precise). We have noticed that in few regions for the first time it takes up to 2 minutes for the DNS to be propagated, but guess what? We're on top of it and soon will make sure it takes less than 10 seconds no matter from where you visit the website.

Notice that by default HTTPS is provided for you websites.

Worth mentioning, any time you make a change to your target branch, the new version of your application is built and deployed right away.



Final note

We're a very young startup with huge goals in our mind. You can be part of the first users who get to know about our features and our journey.
Please join our family by joining our discord channel, and following us on Twitter, and using our service. We have a generous hobby plan!
Please leave a comment if you have any questions or even want to see a private demo!