vannut/statamic-weather-addon

Add a language parameter field to the cp settings

Closed this issue · 1 comments

By adding a select for the lang tag to the blueprint in Settings.php

'lang' => [`
          'width' => 100,
          'type' => 'select',
          'default' => 'EN',
          'options' => [
          'af' => 'Afrikaans',
          'al' => 'Albanian',
          'ar' => 'Arabic',
          'az' => 'Azerbaijani',
          'bg' => 'Bulgarian',
          'ca' => 'Catalan',
          'cz' => 'Czech',
          'da' => 'Danish',
          'de' => 'German',
          'el' => 'Greek',
          'en' => 'English',
          'eu' => 'Basque',
          'fa' => 'Persian (Farsi)',
          'fi' => 'Finnish',
          'fr' => 'French',
          'gl' => 'Galician',
          'he' => 'Hebrew',
          'hi' => 'Hindi',
          'hr' => 'Croatian',
          'hu' => 'Hungarian',
          'id' => 'Indonesian',
          'it' => 'Italian',
          'ja' => 'Japanese',
          'kr' => 'Korean',
          'la' => 'Latvian',
          'lt' => 'Lithuanian',
          'mk' => 'Macedonian',
          'no' => 'Norwegian',
          'nl' => 'Dutch',
          'pl' => 'Polish',
          'pt' => 'Portuguese',
          'pt_br' => 'Português Brasil',
          'ro' => 'Romanian',
          'ru' => 'Russian',
          'se' => 'Swedish',
          'sk' => 'Slovak',
          'sl' => 'Slovenian',
          'es' => 'Spanish',
          'sr' => 'Serbian',
          'th' => 'Thai',
          'tr' => 'Turkish',
          'uk' => 'Ukrainian',
          'vi' => 'Vietnamese',
          'zh_cn' => 'Chinese Simplified',
          'zh_tw' => 'Chinese Traditional',
          'zu' => 'Zulu',
          ],
     'instructions' => 'select your language of choice, default EN',
    ],

and adding the following line to $endpoint in FetchForecast.php

.'&lang='.$this->config->get('lang')

you're able to choose in which language the results will be delivered, from within the control panel :)

Edit: fixed formatting a little

Thank you. I just released a new version containing this addition.