| |
| | |

CodersClub

 Forgot password?
 Register
Search
View: 5720|Reply: 1
Collapse the left

DIY Block MultiLingual HACK.

  [Copy link]

 Taiwan

Post time: 2012-12-05 06:35
| Show all posts |Read mode
I think we should all know DIY use.
The DIY title does not support multi-language conversion.
After following modifications can it support multiple languages.
I try to clearly explanation.

General DIY Block: (By Traditional Chinese)

but English:

DIY Block can't conversion.



Hack after: By Traditional Chinese

By English:




For versions: Discuz! ML X2.0, Discuz! ML X2.5

File: /source/function/function_block.php
Line: About 110~120 lines
Find this lines.
  1. function block_display_batch($bid) {
  2.         echo block_fetch_content($bid);
  3. }
Copy the Code
Modify to:
  1. function block_display_batch($bid) {
  2.         //echo block_fetch_content($bid);
  3.         ml_block_display_batch($bid);
  4. }

  5. function ml_block_display_batch($bid){
  6.         global $_G;
  7.         
  8.         $code = block_fetch_content($bid);
  9.         preg_match_all('/\{lang\(\'(.*?)\',[\s]?\'(\w+)\'\)\}/simx', $code, $result);
  10.         for ($i = 0; $i < count($result[0]); $i++) {
  11.                 $lang=lang($result[1][$i], $result[2][$i]);
  12.                 $code = str_replace($result[0][$i], "<!--<".$result[0][$i].">-->".$lang, $code);
  13.         }        
  14.         echo $code;
  15. }
Copy the Code


Use:






ml-code Example:
You can found "blockclass_thread_script_threadnew" in /source/language/*/lang_blockclass.php
  1. {lang('blockclass', 'blockclass_thread_script_threadnew')}
Copy the Code
attach forum custom block xml-file:
import in forum DIY.

This post contains more resources

You have to Login for download or view attachment(s). No Account? Register

x

 Israel

Post time: 2013-01-29 05:42
| Show all posts
cool. tnx
You have to log in before you can reply Login | Register

Points Rules

Archive|Mobile|Dark room|CodersClub

Top.Mail.Ru
Top.Mail.Ru

2024-05-01 03:31 GMT+3 , Processed in 0.043659 sec., 8 queries .

Powered by Discuz! X3.4 Release 20230520

© 2001-2024 Discuz! Team.

MultiLingual version, Rev. 4301, © codersclub.org

Quick Reply To Top Return to the list