Hello, everyone, and welcome back.
In this lesson, we are going to continue our deep dive into angular internationalization.
Let's start by understanding in detail how the angular internationalization identifiers work.
So so far, we were translating here a couple of strings in our application that were fairly straightforward.
But sometimes a given term has a certain meaning that will depend on the context of the sentence.
The problem is that this text here could be translated into different forms, depending on the context
onto which is being used.
So sometimes we want to provide to the translator a bit more information about the text rather than
the text itself.
If that's the case, we can do so using the ETN attribute.
So here in this attribute, we can specify here the meaning of the term.
In this case, we would like to specify here that this is meant to be a welcome message.
So we're going to specify that here.
We are going to add here in this attribute some information about the context.
So this is a welcome message.
If we need to give to the translator even more information about this particular message.
We can do so by adding here the pipe character and then after the pipe, we can add here some description
that is going to further help the translator to translate this message.
So in this case, the message would be self-explanatory.
But let's just give here an example.
Give the user a greeting at the beginning of the course.
Now that we have added here a meaning and the description to the string, let's quickly run here our
extractor and see what we get in our messages file.
Let's have a look.
So now we have here the same two translation units.
But this time around in the case here of the welcome message we have here, the meaning and the description
in these Nolt tags.
So this will be available to the translator.
The translator is going to load this file in a user interface that is going to display these information
to the translator.
Notice that in most cases, the strings in our application will be self-explanatory and we will not
need to provide extra meaning or an extra description.
This is just in those occasional cases where we need to provide a bit more context to the translator.
Notice that also our idea has changed.
So it now ends in 86.
Let's see what caused this to change.
We are now going back here to our application component and we are going to slightly change here, for
example, the meaning of the string without changing the string itself.
So before we saw that changing here, the content of the string is going to change the idea and it's
going to cause the translator to receive a new request for a translation of the term.
Now, let's change also here, the meaning.
Let's just add here and see what happens.
So the idea ended here in 86.
And if we now run again, our extractor, we are going to see that now.
The idea ends in 31.
So it looks like both the content of the string being translated and its meaning will trigger a new
request.
Translation under the form of a new idea.
Let's now have a look to see what happens if we change here.
The description text we are going to have here again, and not just as an example, if we now run our
extractor again and we switch here to the messages folder, we're going to see that our idea still ends
in 31.
So the conclusion here is that only the content of the message itself and its meaning will trigger the
generation of a new unique identifier.
The description will not affect the identifier.
And therefore, if we simply change the description, this is not going to trigger a new translation
request.
This mechanism of automatically generating an idea based on the string content and the meaning is great
because it means that we just have to edit here our message and the translator will automatically get
notified when it receives the new messages extraction file.
However, there are some cases when we would like by some reason to manually add a translation identifier
to the message.
We can do that by going here to the end of the year, an attribute value.
We have a double Etzion and after that at sine we are going to hear a unique identifier.
Let's say that the unique identifier would be welcome message.
So now going here back to our terminal, we are going to run again, our extractor.
We are going to switch to our messages file and we are going to see that now.
Our translation unit now no longer has a uniquely generated identifier.
Instead, we are taking the idea from.
The string here after the double st, so we have now learned how to provide extra information to the
translator and even to create our own unique translation identify, you noticed that in most cases we
don't need to use either the meaning, the description and especially not the unique identifier, because
it's a lot of work having to add a unique identifier to all the labels of our application.
It's much simpler if we have the unique identifier get automatically generated for us.
So in most cases in your application, you will be using the eatin' and tag simply as it is without
any attribute value.
We should avoid using custom identifiers.
Instead, we should rely as much as possible on the automatically generated identifiers.
And with these simplified use of the an attribute, we are already going to be able to translate most
of our Anjelah application.
Now we are going to talk about a couple of translation special cases.
We are going to talk about pluralization and we are going to talk about alternative terms.