MyBB Community Forums

Full Version: What are those {1} and {2} in the language variables?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(2015-06-04, 07:00 PM)Marisa Wrote: [ -> ]
(2015-06-04, 06:50 PM)XP Mai Wrote: [ -> ]Is there a way to find it myself? I'm planned to edit every word/sentence since the theme of the forum isn't general but for a game. The wordings are too formal and unrelated.

Well you could just remove {2} for example and replace it with the name of a location for example if your game is set in 'New York' then remove the {2} and replace it with 'New York'.

Oops, sorry. The 2nd sentence of mine was just an extra info, no related on how can I find it myself.
I want to find it myself because not all I can guess and I planned to change all, so asking here for every variable isn't a good choice.
Take for instance the variable:

$l['welcome_back'] = "<strong>Welcome back, {1}</strong>. You last visited: {2}";

which is part of the script global.lang.php

Now do a search for the string $lang->welcome_back on your pc in the folder where your forum is stored. You will see that the search result is global.php.

When you open the script  global.php in your editor, you can again do a seach for the string $lang->welcome_back to see the context in which it is used.

Regards,

Ad Bakker
(2015-06-06, 04:53 PM)Ad Bakker Wrote: [ -> ]Now do a search for the string $lang->welcome_back on your pc in the folder where your forum is stored. You will see that the search result is global.php.

Nope. Sad
(2015-06-07, 02:13 PM)XP Mai Wrote: [ -> ]
(2015-06-06, 04:53 PM)Ad Bakker Wrote: [ -> ]Now do a search for the string $lang->welcome_back on your pc in the folder where your forum is stored. You will see that the search result is global.php.

Nope. Sad

OK, it works with Apple OS, I will see whether I can find somethiing for Windows.
Can I ask are all language edits in the admin CP change to the .php file too?
(2015-06-07, 02:29 PM)XP Mai Wrote: [ -> ]Can I ask are all language edits in the admin CP change to the .php file too?

Yes, but you must not be in admin. I assume you have the forum source files on your pc. Go to:

inc/languages/english

you see then a list of xxxxx.lang.php files (do not open the Admin folder), and then do the search. I just tried in Windows, and it works.
(2015-06-07, 02:36 PM)Ad Bakker Wrote: [ -> ]
(2015-06-07, 02:29 PM)XP Mai Wrote: [ -> ]Can I ask are all language edits in the admin CP change to the .php file too?
Yes, but you must not be in admin.

Just to confirm, will it effect the .php if I edit the language through the admin CP?

Previously I used "in" so I think I've made a misunderstanding.
(2015-06-07, 02:36 PM)Ad Bakker Wrote: [ -> ]I assume you have the forum source files on your pc. Go to:

inc/languages/english

you see then a list of xxxxx.lang.php files (do not open the Admin folder), and then do the search. I just tried in Windows, and it works.
Nope, it still doesn't work.

By the way, I realised a pattern:
original function always: xxx.php, in languages would be xxx.language.php

Like Math pattern problem, just subtract away language and I can get answer.
Is that trick accurate?
(2015-06-07, 02:59 PM)XP Mai Wrote: [ -> ]By the way, I realised a pattern:
original function always: xxx.php, in languages would be xxx.language.php

Like Math pattern problem, just subtract away language and I can get answer.
Is that trick accurate?

No, at least not always. For instance language variables in global.lang.php are not only used in global.php, but also in other .php files.
Do you've a documentation containing all variables?

Seems like I can't trust {1} stands for website name, and {2} stands for username

Quote:Send {1} an Email

Does it mean "Send International Union an Email"?

Quote:{1} posts per day | {2} percent of total posts

International Union posts per day | XP percent of total posts

Quote:Send {1} a private message.

Send International Union a private message

Quote:Your username is invalid. Usernames have to be within {1} to {2} characters.

Your username is invalid. Usernames have to be within International Union to XP characters.

PS: International Union is my website name. XP is my username.
No, noone said that these numbers always refer to the same thing. Take a look at http://php.net/sprintf - the MyBB function works similarly. {1}, {2}, {3}, etc. are replacements for arguments passed to the function. For example this call: https://github.com/mybb/mybb/blob/featur...l.php#L465 means that in the $lang->welcome_back string ($l['welcome_back']) {1} is $mybb->user['username'] (username of the current user), {2} is a profile link generated by a function and {3} is $lastvisit (which stores the last visit time as the name suggests). Either check that in the core files, but it should be easy to read most of them by context as someone suggested earlier.
Pages: 1 2