Giter Club home page Giter Club logo

jstrans's People

Contributors

arne-s avatar atmoz avatar cnlevy avatar pawel-baster avatar teian avatar vgoodvin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jstrans's Issues

Is not working with multiple translation files

This is what I have in config

'preload' => array('log', 'jsTrans'),
'components' => array(
    'jsTrans'=>array( 
         'class'=>'application.extensions.JsTrans.JsTrans', 
            'categories'=>array('frontend', 'backend'), // the categories to be made available 
            'languages'=>array('en', 'fr'), // the languages to be made available
        ), 

the dictionary files are created in assets folder.

I have this structure for messages

protected/

  • messages/
    • en/
      • backend.php
      • frontend.php
    • fr/
      • backend.php
      • frontend.php

and is working fine in php, But when I try in JavaScript with JsTrans I can access only variables from frontend

Yii.t('frontend', 'TRANS_VARIABLE') - working fine
Yii.t('backend', 'TRANS_VARIABLE') - not working

even though TRANS_VARIABLE exists in both frontend and backend
Can you help me please.

Use JsTrans with yiic message

Can you please point me to the right direction? I have a Yii project and translation is generated using yiic. I am able to generate string with Yii.t translator.
In JS files I have alert(Yii.t("translate","Your message has been sent successfully"));

I installed your extension this way
Yii::setPathOfAlias('extensions', dirname(FILE).'/../../../extensions');

'import'=>array(
'application.models.',
'application.components.
',
'extensions.JsTrans.*',
),

'jsTrans'=>array(
'class'=>'extensions.JsTrans.JsTrans',
'languages'=>array('en','es'), // the languages to be made available
),

So the confusing part for me is this line in the README file
new JsTrans('app','nl');

Where do I need to put this line of code to work correctly with yiic?

onMissingTransaltion Error 400

I added

public function actionMissingTranslation($category, $message, $language) {
    Yii::t($category, $message, null, null, $language);
}

in controllers/SiteController.php
and my config is

'jsTrans'=>array( 
        'class'=>'ext.JsTrans.JsTrans', 
        'categories'=>array('app'), // the categories to be made available 
        'languages'=>array('fr','es'), // the languages to be made available
        'onMissingTranslation'=>array('site/missingTranslation'), // optional route to handle untranslated messages
    ), 

When I acces site/missingTranslation it gives Error 400: Your request is invalid.
Can you tell how the url should look like?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.