ken Publish time 2012-12-05 06:35

DIY Block MultiLingual HACK.

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.function block_display_batch($bid) {
      echo block_fetch_content($bid);
}Modify to:function block_display_batch($bid) {
      //echo block_fetch_content($bid);
      ml_block_display_batch($bid);
}

function ml_block_display_batch($bid){
      global $_G;
      
      $code = block_fetch_content($bid);
      preg_match_all('/\{lang\(\'(.*?)\',[\s]?\'(\w+)\'\)\}/simx', $code, $result);
      for ($i = 0; $i < count($result); $i++) {
                $lang=lang($result[$i], $result[$i]);
                $code = str_replace($result[$i], "<!--<".$result[$i].">-->".$lang, $code);
      }      
      echo $code;
}

Use:






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

odies Publish time 2013-01-29 05:42

cool. tnx
Pages: [1]
View full version: DIY Block MultiLingual HACK.