collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 403
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: Translating block titles, custom block contents and custom SP pages  (Read 17126 times)

0 Members and 1 Guest are viewing this topic.

Offline andy

  • On Leave
  • *
  • Posts: 861
  • Gender: Male
    • Outdoor Club Japan (OCJ) アウトドア・クラブ・ジャパン
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
  • Elkarte Version: None
I've been unable to find anything about translating the names of blocks (and html contents) or custom pages created in simple portal, and their titles - can you tell me where I can translate them?

Another one isn't really SP but related ... translating the custom menu items.


New to SMF and SP.
Andy
Everyone is a volunteer here so please try and make a small donation to keep the Simple Portal website running


Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Translating block titles, custom block contents and custom SP pages
« Reply #1 on: February 07, 2011, 10:37:44 AM »
I am not sure I understand your question.  I will give some information.  If this does not answer your question, please ask some more.  Please be specific.
 
* You can install different language packs for SMF, and for SimplePortal. SimplePortal language packs are available at http://simpleportal.net/index.php?action=downloads;area=cat2;d64a17a12a=b415fb8cf24f5bbc52bc5ebd9ca81255
 
* If you wish to create a new language pack for your language, please ask here. SimplePortal.net has a tool to make this a little easier than editing the files directly.
 
* The files are all found in Themes/default/Languages/SPortal*.*.php
 
I hope this helps.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline andy

  • On Leave
  • *
  • Posts: 861
  • Gender: Male
    • Outdoor Club Japan (OCJ) アウトドア・クラブ・ジャパン
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
  • Elkarte Version: None
Re: Translating block titles, custom block contents and custom SP pages
« Reply #2 on: February 07, 2011, 11:43:36 AM »
No... I already have the JP language pack for SMF and SP.

I have a site with 2 languages; English and Japanese. I'm moving from a Joomla based site to SMF with a portal but need all SP content - new block titles I make, block HTML content, custom pages, menu tabs etc, to be displayed in both languages when they are switched. At the moment these are only in English.
Right now it is a halfway house with Joomla providing the information pages with SMF in a wrapper. SSI hasn't worked well in Joomla blocks and there is no sync in the languages so I want to use an SMF portal.
http://outdoorclubjapan.com/

I've been testing SMF with Simple Portal here (the one I want to translate):
http://paddington-school.com/smf/

http://paddington-school.com/smf/index.php?language=japanese-utf8

The layout is not final in anyway but you can see that even when the browser detects Japanese and displays the site, all the block titles, contents, pages added in SP that I made, are still in English. I don't know where to access the language strings for these - if there are any. Or where to place equivalent Japanese utf-8 files - something like that standard files like SMF agreement.
Examples:
Left top block: 'Events and Discussion ' ... how to translate title to Japanese.
Information menu tab: Introduction, Event grade and safety.


Andy

« Last Edit: February 07, 2011, 11:56:14 AM by igirisjin »
Everyone is a volunteer here so please try and make a small donation to keep the Simple Portal website running


Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Translating block titles, custom block contents and custom SP pages
« Reply #3 on: February 07, 2011, 02:14:20 PM »
Now I think I understand your question.
You wish to have the block titles change depending on the language selected by the user.
 
SimplePortal does not provide a way to do that.
 
For blocks where you want to provide translations of HTML content, I will suggest that you can do it in the way that SMF and SimplePortal provide "strings" in many different languages.
 
* Instead of an HTML block for Welcome to OCJ, use a php block.
* Instead of the first 3 paragraphs, you would use $txt['OCJ-intro'], instead of the list, you can use $txt['OCJ-list'], instead of the Please Click Here for Japanese text, you can use $txt['OCJ-switchlanguages'] .... and so on.
* Pick a file to keep them in. Then keep them at the bottom of the appropriate-language versions of that file.
* In your php block, you would be echoing a little always-the-same HTML (for the same logo each time, for example), setting up things like lists, and then stringing together your translated strings. Depending on which language is loaded, you will have that version of your strings loaded.
 
For the block titles, my best advice to you for now is to put both titles, where possible, or leave the titles off where possible.
 
It would take a customization of Simpleportal code to allow using $txt strings in the block titles. Which would first take figuring out a sensible syntax for doing that.
 
This would make a good feature request, I think.
Your website is a good example of someone trying to build a multi-lingual portal page.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline andy

  • On Leave
  • *
  • Posts: 861
  • Gender: Male
    • Outdoor Club Japan (OCJ) アウトドア・クラブ・ジャパン
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
  • Elkarte Version: None
Re: Translating block titles, custom block contents and custom SP pages
« Reply #4 on: February 08, 2011, 05:09:46 AM »
Doesn't sound too bad... I will have a go. And you are right the block titles can be done in both languages for most of them - its not a big deal.

One of the big things still outstanding are the pages and menus. Can they be switched if the language is changed?
I don't know what to name the file or where to put it, say for example:
http://paddington-school.com/smf/index.php?page=page3950
This is one of the custom pages made via SP.

Thanks.
Andy

Everyone is a volunteer here so please try and make a small donation to keep the Simple Portal website running


Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Translating block titles, custom block contents and custom SP pages
« Reply #5 on: February 08, 2011, 10:52:49 AM »
The menu buttons are defined in Subs.php, in setupMenuContext.
 
You can see how menu buttons are added to the menu buttons array.
You can add your own buttons there.
 
You can see that setupMenuContext has been written to use $txt strings.
You can do that too -- write your own $txt strings.
 
Ordinarily, I would recommend you look into mods that help you manage your menu buttons without requiring you to write code yourself:
http://custom.simplemachines.org/mods/index.php?action=search;basic_search=menu
http://custom.simplemachines.org/mods/index.php?action=search;basic_search=menu+button
http://custom.simplemachines.org/mods/index.php?action=search;basic_search=top++menu
 
But, as far as I can tell without actually looking at the code, these all require string literals for button titless and can't use $txt indexes.
 
That would be a nice feature request for one of these mods.
I bet there will be other, similar, mods coming out once SMF 2.0 is released.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline andy

  • On Leave
  • *
  • Posts: 861
  • Gender: Male
    • Outdoor Club Japan (OCJ) アウトドア・クラブ・ジャパン
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
  • Elkarte Version: None
Re: Translating block titles, custom block contents and custom SP pages
« Reply #6 on: February 08, 2011, 11:17:08 AM »
Yes Im using a mod for the menus ...
Mod=6 Custom buttons / tabs with Sub Menus
Everyone is a volunteer here so please try and make a small donation to keep the Simple Portal website running


Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Translating block titles, custom block contents and custom SP pages
« Reply #7 on: February 08, 2011, 01:40:35 PM »
You could consider talking to JohnCcCcCc about the possibility of using $txt indexes. Perhaps some funny {{ syntax to tell the code to use a text string instead of the string literal.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline andy

  • On Leave
  • *
  • Posts: 861
  • Gender: Male
    • Outdoor Club Japan (OCJ) アウトドア・クラブ・ジャパン
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
  • Elkarte Version: None
Re: Translating block titles, custom block contents and custom SP pages
« Reply #8 on: September 12, 2011, 01:42:42 PM »
Back ... switched over to Simple Portal but as Im not a php programmer and things are not going as planned.

Could you give some examples of including different language text/html in a block?
Can I not just echo the whole html? Either in English or Japanese.

I looked online and couldnt find examples using $text variable calling a php file.

Only thing I found easy to have a go at was
<?php include("ocj-intro.php"); ?>
But it didnt produce anything.

If possible I would like to output the English html block from a file. I guess it has to go in;
/public_html/Themes/default/languages

Would this be ok for a file containing html to output?
ocj-intro.php

Also in there a Japanese version - would that be?
ocj-intro.japanese-utf8.php


Sorry, Im not familiar at all with php. Civil Engineer with a Masters in I.T. from 1989  :P
And I havent worked in computing or IT. Forgotten C, Assembler, Lisp ... maybe Pascal Ok


Everyone is a volunteer here so please try and make a small donation to keep the Simple Portal website running


Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Translating block titles, custom block contents and custom SP pages
« Reply #9 on: September 12, 2011, 02:19:30 PM »
$txt is just an array that SMF uses to store some text strings.
All the $txt strings are stored in files, and the files can be translated into different languages.

You can see $txt use throughout SMF and SimplePortal -- have a search in PortalBlocks.php, for example.

You can see where SimplePortal's language strings are stored -- in Themes/default/languages/SPortal.english.php, or example, contains most of SimplePortal's strings.

So, if you are creating custom block content, you could do it using a php block.
That content would contain a lot of lines like:
echo $txt['mysite_specialInfo_1'];

That would make the content translatable.

You would also have to load the correct language file. So if it was called "ocj-intro", you would
loadLanguage('ocj-intro', sp_languageSelect('ocj-intro') right at the top of your custom php block.

Then you would have to have ocj-intro.english-utf8.php, ocj-intro.japanese-utf8.php, etc.
Each of these language files would be laid out like the language files you can already find in your language directory.

Is this about as clear as mud?


;
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline andy

  • On Leave
  • *
  • Posts: 861
  • Gender: Male
    • Outdoor Club Japan (OCJ) アウトドア・クラブ・ジャパン
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
  • Elkarte Version: None
Re: Translating block titles, custom block contents and custom SP pages
« Reply #10 on: September 12, 2011, 04:06:29 PM »
Hehe, yes clear as mud... I will have a go this week.
Everyone is a volunteer here so please try and make a small donation to keep the Simple Portal website running


Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Translating block titles, custom block contents and custom SP pages
« Reply #11 on: September 13, 2011, 01:32:10 PM »
Hehe, yes clear as mud...
I'm sorry to hear that. This means it will be a bit of a challenge to you.  I will ask our customizers if they are interested in this little challenge.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Translating block titles, custom block contents and custom SP pages
« Reply #12 on: September 13, 2011, 01:39:27 PM »
another option, which would require less getting-into-files, would be to create different blocks for different languages. Then, they can be done in BBC or HTML or whatever you like. Completely separately.
 
Only, don't display these blocks on any pages of the forum.
Use a simple form of blocks-in-blocks to choose the correct block depending on the language.
http://simpleportal.net/index.php?topic=5332.0
 
Code: [Select]
$block = current(getBlockInfo(false, 49, false, false));  // Load block info
$block['style'] = sportal_parse_style('explode', $block['style'], true);  //Parse block style parameters.
template_block($block); // Output the block.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline steiger

  • Semi Newbie
  • *
  • Posts: 29
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Translating block titles, custom block contents and custom SP pages
« Reply #13 on: January 17, 2013, 06:23:17 AM »
Hi everyone!

I am also currently implementing a dual-language website and have the same problem that block titles can not be translated.
I have read this thread but do not understand how block-in-block would help in this case.

There is no way to enter multiple titles (one for each language) or no way to select a block for a specific language (in this case block-in-block could help).

Maybe the second alternative is easier to implement in SP than the first one?

Any ideas?

Offline steiger

  • Semi Newbie
  • *
  • Posts: 29
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Translating block titles, custom block contents and custom SP pages
« Reply #14 on: January 17, 2013, 07:37:17 AM »
BTW, I have now implemented a quick hack for my PHP blocks to set the block title from within the block.
As I already use jquery for other parts of my site I decided to change the block title on the fly.

In this case '###whoisonline###' is entered as the block title:
Code: [Select]
global $txt;
echo '<script>
h3 = $("h3:contains(\'###whoisonline###\')");
h3.html(h3.html().replace(\'###whoisonline###\', \''.htmlentities($txt['who_title'], ENT_QUOTES).'?\'));
</script>';

it's not beautiful but it does its job :D


My problem is that this only works for my own PHP blocks but not for the SP supplied ones except that I could move the jquery code from the block to the SMF page template.
« Last Edit: January 17, 2013, 07:56:03 AM by steiger »

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Translating block titles, custom block contents and custom SP pages
« Reply #15 on: January 25, 2013, 11:02:02 AM »
Yes.  Changing this for the SP-supplied blocks would require changes to the code.
If you look through the code (the discussion in blocks-in-blocks gives clues on where to begin), you will see where the block titles are used.  Before that point, where the block titel is displayed, you woulud have to have something happeneing to do the translation.  So, perhaps during block formatting you do the translation, storing the result in (something), then you would have to use that (something) during display.

conceptually, the idea is easy. The details of actually implementing it is where you will find your little hassles.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline steiger

  • Semi Newbie
  • *
  • Posts: 29
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Translating block titles, custom block contents and custom SP pages
« Reply #16 on: January 26, 2013, 10:07:58 AM »
Quote
conceptually, the idea is easy. The details of actually implementing it is where you will find your little hassles.

I know but it depends if the SP team is already thinking about doing it or if I will try to mod something.
It appears that there is not much activity in this forum lately, so I don't know how active the SP community really is.
« Last Edit: January 26, 2013, 02:07:39 PM by steiger »

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Translating block titles, custom block contents and custom SP pages
« Reply #17 on: January 27, 2013, 01:05:59 PM »
I do believe that if you came up with a mod for that, it would be well-received.

The truth is that now is the time for the Simple Portal to find and recruit new developers.
I believe that the best way to develop for Simple Portal right now is by creating mods for Simple Portal.

Lots of people want this; they will say thank you to you!
If it is GREAT code, "everyone" will lobby to get it into some future version of Simple Portal.

Go for it.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline steiger

  • Semi Newbie
  • *
  • Posts: 29
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Translating block titles, custom block contents and custom SP pages
« Reply #18 on: January 27, 2013, 01:09:31 PM »
Let's see.
I just went live with my migrated website and after >250h in the last weeks I need some distance to this. ;D

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Translating block titles, custom block contents and custom SP pages
« Reply #19 on: January 31, 2013, 08:24:58 AM »
Congratulations on going live with your website.
There is no pressure on you to create a new mod for Simple Portal.

If you decide to work on it, you will get as much help as the denizens around here can provide.
And a resounding pat on the back for any useful stuff you produce!

Enjoy your website and welcome to Simple Portal
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?