Updated 067 Adding Language String to your Component and get the Language Placeholder for dynamic use (markdown)

Amigo 2019-09-30 06:52:53 +02:00
parent 06fd1c69ff
commit bf9d680071
1 changed files with 10 additions and 1 deletions

@ -1,6 +1,15 @@
# ADDING LANGUAGE STRING TO YOUR COMPONENT AND GET THE LANGUAGE PLACEHOLDER FOR DYNAMIC USE
### Quick Tip How To Add String To Your Component
[00:00:00](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m00s)
(Click on these time links to see Youtube video)
This is a quick Sort of tip on how to add a language string To your component Without a language string Being immediately Added to the J text Object function Which translates it of course So let me demonstrate So normal language string you use this J text And you'd [00:00:32](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m32s) Add your string in there And then JCB when it compiles It Actually adds that string to your language file And then when your component runs that string is translated because it has a Placeholder in its place And you can then have multiple places where the string is used So that's Already there and works well the new feature [00:00:59](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m59s) Is Mostly used when you are dealing with a class And you working with a Array In the class And If You want to have class method or rather Fields That is an array of Strings but you can't of course use this [00:01:20](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m20s) In the array of a class Value so That is one place but there are many places Where you could see this in action So what you would wanna do is you want the placeholder to be generated You want the String to be added to the language file But you only want a placeholder as a string to be added to your Script Because only later in the script you're going to add it [00:01:52](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m52s) to the Jtext Option to translate this place holder And so often you we would run into such a case well I have in anyway so The way we've addressed this Is with a new Basically a new name Just text Like that so [00:02:16](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m16s) This part looks exactly the same as the J text So this almost seems like this is a class but it's not really it's just Something that the JCB compiler will pick up And it'll convert this let me show you how it will look when it has converted it And you'll see why it makes sense you see I've got this extra field Properties And it's got these Keys And I want to use the key to get the string So if we go a little lower in the script [00:02:49](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m49s) You see I'm here I'm looping through that array And The value description I'm only here passing it to the J text To translate it So that means I wanna do the this translating later And I actually all I want in this array above here is actually the placeholder string So let me show you that in the code how it actually comes out [00:03:16](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m16s) So in the code here you see the extra field properties and you see it's simply a a string It actually took away the bracket here if you look at the way it was So I'm going to paste in the The one from the code Just so that you can see What it's done So here you can see [00:03:40](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m40s) This is what we added in JCB And this is what it did In compilation It added the placeholder string Which we can then use Down here In our Jtext To translate it to get the Specific translated string So that's a way to get the placeholder and to get obviously the string into your language file [00:04:09](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m09s) That's just a little tip I know that It's not very obvious So I hope it will come in handy to those of you who want to add language strings To JCB But you don't want to have it immediately be Part of the Jtext object Call you want to just have the actual placeholder available for use dynamically This is the way you can do that Thanks for watching enjoy
This is a quick tip on how to add a language string to your component. Without a language string being immediately added to the Jtext object function, which translates it of course. Let me demonstrate. Normal language string, you would use Jtext and you'd [00:00:32](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m32s) add your string in there. When JCB compiles it, it adds that string to your language file. When your component runs, that string is translated because it has a placeholder in its place. You can then have multiple places where the string is used. That's already there and works well. The new feature [00:00:59](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m59s) is mostly used when you are dealing with a class and you are working with an array in the class. If you want to have class method or rather fields that is an array of strings, but you can't use this [00:01:20](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m20s) in the array of a class value. That is one place but there are many places where you could see this in action.
### Want The Placeholder To Be Generated
[00:01:32](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m32s)
???
What you would want to do is you want the placeholder to be generated. You want the string to be added to the language file. But you only want a placeholder as a string to be added to your Script. Because only later in the script you're going to add it to the Jtext option to translate this placeholder. And so often you we would run into such a case well I have in anyway so The way we've addressed this Is with a new Basically a new name Just text Like that so [00:02:16](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m16s) This part looks exactly the same as the J text So this almost seems like this is a class but it's not really it's just Something that the JCB compiler will pick up And it'll convert this let me show you how it will look when it has converted it And you'll see why it makes sense you see I've got this extra field Properties And it's got these Keys And I want to use the key to get the string So if we go a little lower in the script [00:02:49](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m49s) You see I'm here I'm looping through that array And The value description I'm only here passing it to the J text To translate it So that means I wanna do the this translating later And I actually all I want in this array above here is actually the placeholder string So let me show you that in the code how it actually comes out [00:03:16](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m16s) So in the code here you see the extra field properties and you see it's simply a a string It actually took away the bracket here if you look at the way it was So I'm going to paste in the The one from the code Just so that you can see What it's done So here you can see [00:03:40](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m40s) This is what we added in JCB And this is what it did In compilation It added the placeholder string Which we can then use Down here In our Jtext To translate it to get the Specific translated string So that's a way to get the placeholder and to get obviously the string into your language file [00:04:09](https://www.youtube.com/watch?v=_mXlbAO79J8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m09s) That's just a little tip I know that It's not very obvious So I hope it will come in handy to those of you who want to add language strings To JCB But you don't want to have it immediately be Part of the Jtext object Call you want to just have the actual placeholder available for use dynamically This is the way you can do that Thanks for watching enjoy