Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8146011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:51:06+00:00 2026-06-06T13:51:06+00:00

I am interested to know is there a script or otherway available to collect

  • 0

I am interested to know is there a script or otherway available to collect and generate Yii translation messages in a controller/project

Eg. If I have the following codes in a controller

Yii::t('blog', 'Your name');
Yii::t('category', 'Category name');

It should generate English translation message files as blog.php and category.php with above strings in messages directory. Please let me know if somebody knows a way. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:51:07+00:00Added an answer on June 6, 2026 at 1:51 pm

    There’s no need to reinvent the wheel. You can use yiic for that (if you go to the framework folder and type in yiic help message you will get all the info to need about it’s usage). For convenience, I’m going to paste it here.

    USAGE yiic message path/to/config/file

    DESCRIPTION This command searches for messages to be translated in
    the specified source files and compiles them into PHP arrays as
    message source.

    PARAMETERS * config-file: required, the path of the configuration
    file. You can find an example in framework/messages/config.php.

    The file can be placed anywhere and must be a valid PHP script
    which returns an array of name-value pairs. Each name-value pair
    represents a configuration option.

    The following options are available:

    • sourcePath: string, root directory of all source files.
    • messagePath: string, root directory containing message translations.
    • languages: array, list of language codes that the extracted messages
      should be translated to. For example, array(‘zh_cn’,’en_au’).
    • fileTypes: array, a list of file extensions (e.g. ‘php’, ‘xml’).
      Only the files whose extension name can be found in this list
      will be processed. If empty, all files will be processed.
    • exclude: array, a list of directory and file exclusions. Each
      exclusion can be either a name or a path. If a file or directory name
      or path matches the exclusion, it will not be copied. For example,
      an exclusion of ‘.svn’ will exclude all files and directories whose
      name is ‘.svn’. And an exclusion of ‘/a/b’ will exclude file or
      directory ‘sourcePath/a/b’.
    • translator: the name of the function for translating messages.
      Defaults to ‘Yii::t’. This is used as a mark to find messages to be
      translated.
    • overwrite: if message file must be overwritten with the merged messages.
    • removeOld: if message no longer needs translation it will be removed,
      instead of being enclosed between a pair of ‘@@’ marks.

    You should modify (and move) the example config file and you’re all set. Be sure to use full paths (ie. C:\path\to\project on Windows or /var/www/your/project on *nix)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are many things that all programmers should know, but I am particularly interested
This is just an efficiency question really.. I'm interested to know if there is
I know very, very little of javascript, but I'm interested in writing a script
I am interested to know the best way to develop en JS. If I
I am interested to know what a proper x (vector matrix or data frame)
I am interested to know how can I do the same thing that the
I am interested to know how the DNS requests to political sites differ in
Question: I'm interested to know the best practice for killing a long standing operation
I am interested to know how an URL-based api key restriction works, such as
I was interested to know about parameters other than space and time during analysing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.