{"action":"reopened","issue":{"url":"https://api.github.com/repos/goldsky/Lingua/issues/27","labels_url":"https://api.github.com/repos/goldsky/Lingua/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/goldsky/Lingua/issues/27/comments","events_url":"https://api.github.com/repos/goldsky/Lingua/issues/27/events","html_url":"https://github.com/goldsky/Lingua/issues/27","id":51452626,"number":27,"title":"lingua.getValue Snippet doesn't default properly","user":{"login":"valZho","id":294863,"avatar_url":"https://avatars.githubusercontent.com/u/294863?v=3","gravatar_id":"","url":"https://api.github.com/users/valZho","html_url":"https://github.com/valZho","followers_url":"https://api.github.com/users/valZho/followers","following_url":"https://api.github.com/users/valZho/following{/other_user}","gists_url":"https://api.github.com/users/valZho/gists{/gist_id}","starred_url":"https://api.github.com/users/valZho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valZho/subscriptions","organizations_url":"https://api.github.com/users/valZho/orgs","repos_url":"https://api.github.com/users/valZho/repos","events_url":"https://api.github.com/users/valZho/events{/privacy}","received_events_url":"https://api.github.com/users/valZho/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-12-09T16:59:59Z","updated_at":"2015-01-31T03:55:55Z","closed_at":null,"body":"When using the lingua.getValue snippet, data is not pulled from the default language. This bug affects not only instances when the selected translation isn't available, but instances where the default language is the one selected; in either case, lingua.getValue will return nothing.\r\n\r\nThis snippet should always return the value for the default language (i.e., the value from modx_site_content) if the translated value doesn't exist (i.e., the value from modx_lingua_site_content).\r\n\r\nTo get around this problem, I had to write the following wrapper snippet that I call instead of lingua.getValue:\r\n\r\n    // initialize\r\n    $vars = array(\r\n    \t'id'=>$id,\r\n    \t'field'=>$field\r\n    );\r\n    \r\n    // get translated field\r\n    $field = $modx->runSnippet('lingua.getValue', $vars);\r\n    \r\n    // if no translation, then get default\r\n    if (empty($field)) {\r\n    \t$field = $modx->runSnippet('getResourceField', $vars);\r\n    }\r\n\r\n\r\n"}}