in progress adding language strings

blindmime
@blindmime
10 years ago
772 posts
How do I add a string via the language control panel?
updated by @blindmime: 01/20/15 05:06:09PM
brian
@brian
10 years ago
10,148 posts
blindmime:
How do I add a string via the language control panel?

You can't - you'd need to add it to a language file. If you can let me know what you're looking to do I might be able to offer an idea of how to do it.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Strumelia
Strumelia
@strumelia
10 years ago
3,603 posts
Ah, I had the same question!
I'll be interested in knowing what Blindmime was wanting to do, but in my own case:

I wanted to add a link for "Blogs" to my top navigation menu strip.
To do so, I copied and edited one that was already there in my skin's header_menu/tpl template, like for "videos" and changed the code to point the new link to the /blog page. But the code had an "ID #" which would need to be the line number for the word "Blogs" in the Language file...only there was no word Blogs in that language file. If I could add it, then I could fill in the line ID# in the code to create the link, and all my header menu link codes would be similarly constructed.

I stumbled onto a workaround for it (which I won't describe), but I still was left wondering how I could add a word or term to a module's language file so i could insert the line# ID for that word in code when needed. Yikes hope this isn't too confusing. Maybe I am missing some key concept about language strings/files and how they are used or created.


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015

updated by @strumelia: 12/13/14 09:19:13AM
brian
@brian
10 years ago
10,148 posts
The best way (right now) to handle this would be to add the new lang string to the bottom of your custom skin language file - i.e.

skins/CustomSkin/lang/en-US.php

i.e.:

$_lang[100] = 'Blogs';

IF the last entry is at index 99 that's what you would add.

Next, run the Integrity Check and that will "add" that new lang string into the Core.

Then, in your templates you can use:

{jrCore_lang skin="CustomSkin" id=100 default="Blogs"}

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Strumelia
Strumelia
@strumelia
10 years ago
3,603 posts
Brian, when I get to where I 'think' I am supposed to be in order to add the new lang string, I see this dire warning:

// DO NOT EDIT THIS FILE. THIS FILE IS ONLY LOADED DURING INSTALLATION.
// ANY CHANGES TO LANGUAGE STRINGS SHOULD BE DONE IN THE CONTROL PANEL!
$lang[1] = 'home';
$lang[2] = 'cart';
$lang[3] = 'search';
$lang[4] = 'create account';
$lang[5] = 'login';
$lang[6] = 'Older Posts';
$lang[7] = 'Change Image';
$lang[8] = 'About';
$lang[9] = 'Latest Followers';
$lang[10] = 'Recently Rated';
$lang[11] = 'Pages';
etc...

That ominous warning is causing me to not go ahead with my change...should I ignore the warning in order to add the new lang string?

And...this may sound dumb but... I WAS in the cPanel when I selected that file and clicked Edit...so why is it telling me to edit the file in the control panel instead...??

confused.


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
SteveX
SteveX
@ultrajam
10 years ago
2,584 posts
Strumelia:...should I ignore the warning in order to add the new lang string?

Yes, you need to ignore that to add the new string.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
Strumelia
Strumelia
@strumelia
10 years ago
3,603 posts
Ok, I was afraid to do anything, like it might explode. lolol


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
Strumelia
Strumelia
@strumelia
10 years ago
3,603 posts
Testing the auto-smiley function:
lollipop.

....D'OHHHH! l.o.l.


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015

updated by @strumelia: 12/13/14 12:48:52PM
brian
@brian
10 years ago
10,148 posts
Strumelia:
I WAS in the cPanel when I selected that file and clicked Edit...so why is it telling me to edit the file in the control panel instead...??

confused.

There is no way to edit the en-US.php filen directly from within the Jamroom ACP - I assume you mean you were in your web hosting control panel? That is different than Jamroom's admin control panel.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

updated by @brian: 12/14/14 08:56:45AM
Strumelia
Strumelia
@strumelia
10 years ago
3,603 posts
Yes I was in my Arvixe server cPanel, for the simple reason that I couldn't find the "skins/CustomSkin/lang/en-US.php" file by searching around within the JR ACP...so I went to my server file manager, under the skin, and found it there and went to edit it as was suggested. It was the strong code warning message within that php file code that gave me pause and made me afraid to edit anything. Now I know i should just ignore that warning (I guess).

I'm assuming that by "Jamroom's admin control panel" you mean: http://(mysite).com/core/admin/tools -If that is NOT correct please let me know. Thanks!


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
paul
@paul
10 years ago
4,326 posts
No - Go into your Admin Control Panel (ACP) and click on the 'skins' tab on the left. You should see the setting for the default skin. See the tabs along the top? Click on 'language' to edit the skin's language strings.


--
Paul Asher - JR Developer and System Import Specialist
Strumelia
Strumelia
@strumelia
10 years ago
3,603 posts
Paul, I kept going there, but I don't understand how I can add a new string word, like "Blogs".
Here is a screenshot from my JR ACP, ...can you please tell me how I can add #40 for the term Blogs anywhere? No place to add that I can see, been clicking everywhere, it's been driving me nuts... that's why I then went to my server files instead. ? What am I missing ?


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015

updated by @strumelia: 12/14/14 02:29:52PM
paul
@paul
10 years ago
4,326 posts
Actually you can't add language strings via the ACP, only edit existing ones.
Let me see if there's anything that can be done about that.
Thanks


--
Paul Asher - JR Developer and System Import Specialist
Strumelia
Strumelia
@strumelia
10 years ago
3,603 posts
For example, I could not add "Blogs" so I could make a top nav bar LINK.

I can adjust current ones, like changing "Images" to "Photos", and changing "Profiles" to "Members"- all of which will be more friendly and familiar to my members. But I can't add a NEW unrelated one. And when I tried editing a seemingly unneeded string to "Blogs" instead, it then messed up something elsewhere, so I had to set it back.

Yes I think it would be very cool to be able to add a string and ID # at the end of the list! :)


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
michael
@michael
10 years ago
7,714 posts
Just to be clear, you dont need to use the language system. Its there for those that want to translate their site into another language. If your site is only english, you can choose to not-use the language system and just put the text in directly.

So in locations where you see:
{jrCore_lang skin="CustomSkin" id=100 default="Blogs"}
you could just use Blogs directly in the template if you wanted to.
Strumelia
Strumelia
@strumelia
10 years ago
3,603 posts
michael:
So in locations where you see:
{jrCore_lang skin="CustomSkin" id=100 default="Blogs"}
you could just use Blogs directly in the template if you wanted to.

Oh, I see. So then instead of my putting
{jrCore_lang skin="CustomSkin" id=100 default="Blogs"}

I could take out the "id=100" part and just put, what?:
{jrCore_lang skin="CustomSkin" default="Blogs"}
?


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
michael
@michael
10 years ago
7,714 posts
Strumelia:
michael:
So in locations where you see:
{jrCore_lang skin="CustomSkin" id=100 default="Blogs"}
you could just use Blogs directly in the template if you wanted to.

Oh, I see. So then instead of my putting
{jrCore_lang skin="CustomSkin" id=100 default="Blogs"}

I could take out the "id=100" part and just put, what?:
{jrCore_lang skin="CustomSkin" default="Blogs"}
?

nope, instead of putting
{jrCore_lang skin="CustomSkin" id=100 default="Blogs"}
you could put
Blogs
Strumelia
Strumelia
@strumelia
10 years ago
3,603 posts
Ok, but...in what template? (since I don't have the code with the "id=100..." anyway)
....In my skins/CustomSkin/lang/en-US.php file in my server cpanel?


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
michael
@michael
10 years ago
7,714 posts
.tpl files are very similar to .html files.

What you put in them determines what comes out on the screen.

So wherever you were going to try to put {jrCore_lang skin="CustomSkin" id=100 default="Blogs"} to get the word 'blog' to come out, then thats where can just use the word instead.

as to where you want to put it, I can't decide that for you. Just saying that everywhere you see {jrCore_lang....} know that that is part of the system to allow language customization. If you don't need to use language customization, you don't need to.

--edit--
The top nav bar links are in:
/skins/YOUR-SKIN/header_menu_desktop.tpl

if that's the question.
updated by @michael: 12/15/14 10:59:45PM
blindmime
@blindmime
10 years ago
772 posts
I think Brian and Paul have suggested they may be working on a way to add strings to a language file via the ACP. I often do as Michael says and just bypass the language id's altogether, but I think it would be best to use language id's in case I might want to add a language later.

However, I can see the complication in this. My custom id of 100 in the english language would have to match id 100 in spanish, I'm guessing. But what happens if a later jamroom updated language file uses the same id? Wouldn't I want to use something like id 10006 like what happens when you add a field in the form designer? How do you ensure all the custom id's match up? What about all the id's in all the various modules? How does that work?

Also, where does the "use default" button in the ACP get the default string? Is it the language php file?
brian
@brian
10 years ago
10,148 posts
JR already inserts "custom" language strings if you add any custom fields via the form designer, so it's already supported internally - we just to expose it in the Language tab which is on our todo.

The lang file is the "default" - if you reset a lang string to the default it is reset to what is in the lang file.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
10 years ago
198 posts
I made my own language file for my custom modules. In language directory i created two files named En-en.php and TR-tr.php (for Turkish language) and add the strings in those file so i can use them in templates.

Actually i made them for every modules i use. Than i find out that i could made it with cloning language strings from user accounts > tools section.

So if you want to add a line to language file you can do that but if there will be an update for that module/skin your modified language file will be left in the old directory. You can replace the file to the new directory but you must check the new language file in the new release's language directory if there is any changes, any additional lines.

And you need to make integrity check after modifying language files.
updated by @melih: 12/16/14 08:25:40AM
brian
@brian
10 years ago
10,148 posts
Melih:
And you need to make integrity check after modifying language files.

Yep - this is good to remember - you won't see your changes until you run an integrity check - EVEN if you are running in Developer Mode.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Strumelia
Strumelia
@strumelia
10 years ago
3,603 posts
Michael, thanks, I think I understand what you said. :)


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015

Tags