Permalink
Browse files

full separation of strings to localised.yaml files

  • Loading branch information...
1 parent a0fe655 commit 04f1c5da93ad7eda1b4038a846472d7662902657 @RogueM RogueM committed Nov 3, 2016
View
@@ -24,9 +24,13 @@
default_strings = {
'home': 'Home',
'boards': 'Boards',
+ 'details': 'Details',
'pin_header': '{} pin header',
'form_undefined': 'Undefined',
'group_other': 'other',
+ 'type_hat': 'HAT form-factor',
+ 'type_phat': 'pHAT form-factor',
+ 'type_classic': 'Classic form-factor',
'eeprom_detect': 'Uses VID/PID',
'eeprom_setup': 'Uses EEPROM',
'uses_5v_and_3v3': 'Needs 5v and 3v3 power',
@@ -38,6 +42,7 @@
'bcm_pin_rev1_pi': 'BCM pin {} on Rev 1 ( very early ) Pi',
'physical_pin_n': 'Physical pin {}',
'wiring_pi_pin': 'Wiring Pi pin {}',
+ 'made_by': 'Made by {manufacturer}',
'more_information': 'More Information',
'github_repository': 'GitHub Repository',
'board_schematic': 'Schematic',
@@ -487,7 +492,7 @@ def get_lang_urls(src):
overlays = pinout.settings['overlays']
-strings = pinout.get_setting('strings', {})
+strings = pinout.get_string('strings', {})
if type(strings) == list:
_strings = {}
@@ -662,8 +667,8 @@ def interfaces_menu(current):
content=pin_html,
resource_url=resource_url,
overlays=overlays_html,
- description=pinout.settings['default_desc'],
- title=pin_title + pinout.settings['title_suffix'],
+ description=strings['default_desc'],
+ title=pin_title + strings['title_suffix'],
featured_boards=featured_boards_html,
langcode=lang,
nav_html=nav_html,
@@ -700,12 +705,12 @@ def interfaces_menu(current):
langlinks = get_lang_urls(src)
if not 'description' in pages[url]:
- pages[url]['description'] = pinout.settings['default_desc']
+ pages[url]['description'] = strings['default_desc']
- name = pinout.settings['default_title']
+ name = strings['default_title']
if 'name' in pages[url]:
- name = pages[url]['name'] + pinout.settings['title_suffix']
+ name = pages[url]['name'] + strings['title_suffix']
feat_boards_html = featured_boards_html
View
@@ -7,8 +7,9 @@
exit("This script requires the yaml module\nInstall with: sudo pip install PyYAML")
-DB_FILE = 'pi-pinout.yaml'
+PINOUT_FILE = 'pinout.yaml'
SETTINGS_FILE = 'settings.yaml'
+STRINGS_FILE = 'localised.yaml'
pins = None
settings = None
@@ -21,6 +22,11 @@ def get_setting(setting, default = None):
return settings[setting]
return default
+def get_string(string, default = None):
+ if string in strings and strings[string] != None:
+ return strings[string]
+ return default
+
def render_html(*args, **kwargs):
html = master_template
@@ -93,15 +99,17 @@ def physical_to(pin, scheme='bcm'):
def load(lang='en'):
- global pins, settings
- if DB_FILE.endswith('.yaml'):
- db = yaml.load(open('src/{}/{}'.format(lang, DB_FILE)).read())
- else:
- db = json.load(open('src/{}/{}'.format(lang, DB_FILE)))
+ global pins, settings, strings
if SETTINGS_FILE.endswith('.yaml'):
settings = yaml.load(open('src/{}/{}'.format(lang, SETTINGS_FILE)).read())
else:
settings = json.load(open('src/{}/{}'.format(lang, SETTINGS_FILE)))
- pins = db['pins']
-
-
+ if STRINGS_FILE.endswith('.yaml'):
+ strings = yaml.load(open('src/{}/template/{}'.format(lang, STRINGS_FILE)).read())
+ else:
+ strings = json.load(open('src/{}/template/{}'.format(lang, STRINGS_FILE)))
+ if PINOUT_FILE.endswith('.yaml'):
+ pinout = yaml.load(open('src/{}/template/{}'.format(lang, PINOUT_FILE)).read())
+ else:
+ pinout = json.load(open('src/{}/template/{}'.format(lang, PINOUT_FILE)))
+ pins = pinout['pins']
View
@@ -1,38 +1,10 @@
----
-default_desc: The comprehensive Raspberry Pi GPIO Pinout guide for the original Raspberry
-default_title: Raspberry Pi GPIO Pinout
-title_suffix: " at Raspberry Pi GPIO Pinout"
-base_url: /pinout/
-resource_url: /resources/
domain: de.pinout.xyz
analytics_id: UA-69846516-4
+base_url: /pinout/
+resource_url: /resources/
url_suffix:
urls:
GND: masse_ground
-strings:
-- details: 'Details'
-- group_other: 'alle'
-- form_undefined: 'Andere'
-- pin_header: '{} pin header'
-- type_hat: 'HAT form-factor'
-- type_phat: 'pHAT form-factor'
-- type_classic: 'Classic form-factor'
-- eeprom_detect: 'EEPROM Hersteller ID'
-- eeprom_setup: 'benutzt EEPROM'
-- uses_i2c: 'benutzt I2C'
-- uses_spi: 'benutzt SPI'
-- uses_5v_and_3v3: '5v und 3v3 Stromversorgung'
-- uses_5v: '5v Stromversorgung'
-- uses_3v3: '3v3 Stromversorgung'
-- uses_n_gpio_pins: 'benutzt {} GPIO Anschlüsse'
-- bcm_pin_rev1_pi: 'BCM Anschluss {} auf dem Rev 1 ( sehr alter ) Pi'
-- physical_pin_n: 'Physical pin {}'
-- wiring_pi_pin: 'Wiring Pi Anschluss {}'
-- made_by: 'Hersteller: {manufacturer}'
-- more_information: 'Mehr Informationen'
-- github_repository: 'GitHub'
-- board_schematic : 'Schematic'
-- buy_now: 'jetzt kaufen'
featured:
- display-o-tron
- rpf-dots
@@ -0,0 +1,33 @@
+strings:
+- default_desc: 'The comprehensive Add-on boards & GPIO Pinout guide for the Raspberry Pi'
+- default_title: 'Raspberry Pi GPIO Pinout'
+- title_suffix: ' at Raspberry Pi GPIO Pinout'
+- home: 'Home'
+- boards: 'Boards'
+- details: 'Details'
+- group_other: 'alle'
+- form_undefined: 'Andere'
+- pin_header: '{} pin header'
+- type_hat: 'HAT form-factor'
+- type_phat: 'pHAT form-factor'
+- type_classic: 'Classic form-factor'
+- eeprom_detect: 'EEPROM Hersteller ID'
+- eeprom_setup: 'benutzt EEPROM'
+- uses_i2c: 'benutzt I2C'
+- uses_spi: 'benutzt SPI'
+- uses_5v_and_3v3: '5v und 3v3 Stromversorgung'
+- uses_5v: '5v Stromversorgung'
+- uses_3v3: '3v3 Stromversorgung'
+- uses_n_gpio_pins: 'benutzt {} GPIO Anschlüsse'
+- bcm_pin_rev1_pi: 'BCM Anschluss {} auf dem Rev 1 ( sehr alter ) Pi'
+- physical_pin_n: 'Physical pin {}'
+- wiring_pi_pin: 'Wiring Pi Anschluss {}'
+- made_by: 'Hersteller: {manufacturer}'
+- more_information: 'Mehr Informationen'
+- github_repository: 'GitHub'
+- board_schematic : 'Schematic'
+- buy_now: 'jetzt kaufen'
+- browse_addons: 'Browse more HATs, pHATs and add-ons'
+- return_home: 'Return to the Raspberry Pi GPIO Pinout'
+- boards_title: 'Raspberry Pi HATs, pHATs & Add-ons'
+- boards_subtitle: 'Click on a HAT, pHAT or add-on for more details and to see which pins it uses!'
File renamed without changes.
View
@@ -1,44 +1,10 @@
----
-default_desc: The comprehensive Add-on boards & GPIO Pinout guide for the Raspberry Pi
-default_title: Raspberry Pi GPIO Pinout
-title_suffix: " at Raspberry Pi GPIO Pinout"
-base_url: /pinout/
-resource_url: /resources/
domain: pinout.xyz
analytics_id: UA-69846516-1
+base_url: /pinout/
+resource_url: /resources/
url_suffix:
urls:
GND: ground
-strings:
-- home: 'Home'
-- boards: 'Boards'
-- details: 'Details'
-- group_other: 'other'
-- form_undefined: 'Undefined'
-- pin_header: '{} pin header'
-- type_hat: 'HAT form-factor'
-- type_phat: 'pHAT form-factor'
-- type_classic: 'Classic form-factor'
-- eeprom_detect: 'EEPROM product ID'
-- eeprom_setup: 'EEPROM auto configuration'
-- uses_i2c: 'Communication over I2C'
-- uses_spi: 'Communication over SPI'
-- uses_5v_and_3v3: 'Needs 5v and 3v3 power'
-- uses_5v: 'Needs 5v power'
-- uses_3v3: 'Needs 3v3 power'
-- uses_n_gpio_pins: 'Uses {} GPIO pins'
-- bcm_pin_rev1_pi: 'BCM pin {} on Rev 1 ( very early ) Pi'
-- physical_pin_n: 'Physical pin {}'
-- wiring_pi_pin: 'Wiring Pi pin {}'
-- made_by: 'Made by {manufacturer}'
-- more_information: 'More Information'
-- github_repository: 'GitHub Repository'
-- board_schematic : 'Schematic'
-- buy_now: 'Buy Now'
-- browse_addons: 'Browse more HATs, pHATs and add-ons'
-- return_home: 'Return to the Raspberry Pi GPIO Pinout'
-- boards_title: 'Raspberry Pi HATs, pHATs & Add-ons'
-- boards_subtitle: 'Click on a HAT, pHAT or add-on for more details and to see which pins it uses!'
featured:
- pijack
- mote-phat
@@ -0,0 +1,33 @@
+strings:
+- default_desc: 'The comprehensive Add-on boards & GPIO Pinout guide for the Raspberry Pi'
+- default_title: 'Raspberry Pi GPIO Pinout'
+- title_suffix: ' at Raspberry Pi GPIO Pinout'
+- home: 'Home'
+- boards: 'Boards'
+- details: 'Details'
+- group_other: 'other'
+- form_undefined: 'Undefined'
+- pin_header: '{} pin header'
+- type_hat: 'HAT form-factor'
+- type_phat: 'pHAT form-factor'
+- type_classic: 'Classic form-factor'
+- eeprom_detect: 'EEPROM product ID'
+- eeprom_setup: 'EEPROM auto configuration'
+- uses_i2c: 'Communication over I2C'
+- uses_spi: 'Communication over SPI'
+- uses_5v_and_3v3: 'Needs 5v and 3v3 power'
+- uses_5v: 'Needs 5v power'
+- uses_3v3: 'Needs 3v3 power'
+- uses_n_gpio_pins: 'Uses {} GPIO pins'
+- bcm_pin_rev1_pi: 'BCM pin {} on Rev 1 ( very early ) Pi'
+- physical_pin_n: 'Physical pin {}'
+- wiring_pi_pin: 'Wiring Pi pin {}'
+- made_by: 'Made by {manufacturer}'
+- more_information: 'More Information'
+- github_repository: 'GitHub Repository'
+- board_schematic : 'Schematic'
+- buy_now: 'Buy Now'
+- browse_addons: 'Browse more HATs, pHATs and add-ons'
+- return_home: 'Return to the Raspberry Pi GPIO Pinout'
+- boards_title: 'Raspberry Pi HATs, pHATs & Add-ons'
+- boards_subtitle: 'Click on a HAT, pHAT or add-on for more details and to see which pins it uses!'
File renamed without changes.
View
@@ -1,44 +1,10 @@
----
-default_desc: La guía detallada sobre el pinout del GPIO de Raspberry Pi para Raspberry
-default_title: Pinout de Raspberry Pi - Pi 1, B+, Pi 2
-title_suffix: " at Raspberry Pi GPIO Pinout"
-base_url: /pinout/
-resource_url: /resources/
domain: es.pinout.xyz
analytics_id: UA-69846516-5
+base_url: /pinout/
+resource_url: /resources/
url_suffix:
urls:
GND: tierra
-strings:
-- home: 'Home'
-- boards: 'Boards'
-- details: 'Details'
-- group_other: 'otro'
-- form_undefined: 'Otro'
-- pin_header: '{} pin header'
-- type_hat: 'formato HAT'
-- type_phat: 'formato pHAT'
-- type_classic: 'formato clásico'
-- eeprom_detect: 'EEPROM ID'
-- eeprom_setup: 'Usa EEPROM'
-- uses_i2c: 'Usa I2C'
-- uses_spi: 'Usa SPI'
-- uses_5v_and_3v3: 'Alimentación 5v+3v3'
-- uses_5v: 'Alimentación 5v'
-- uses_3v3: 'Alimentación 3v3'
-- uses_n_gpio_pins: 'Usa {} GPIO pins'
-- bcm_pin_rev1_pi: 'BCM pin {} on Rev 1 ( very early ) Pi'
-- physical_pin_n: 'Physical pin {}'
-- wiring_pi_pin: 'Wiring Pi pin {}'
-- made_by: 'Hecho por {manufacturer}'
-- more_information: 'More Information'
-- github_repository: 'GitHub'
-- board_schematic : 'Schematic'
-- buy_now: 'Buy Now'
-- browse_addons: 'Browse more HATs, pHATs and add-ons'
-- return_home: 'Return to the Raspberry Pi GPIO Pinout'
-- boards_title: 'Raspberry Pi HATs, pHATs & Add-ons'
-- boards_subtitle: 'Click on a HAT, pHAT or add-on for more details and to see which pins it uses!'
featured:
- ab-adc-pi-zero
- analog-zero
@@ -0,0 +1,33 @@
+strings:
+- default_desc: 'La guía detallada sobre el pinout del GPIO de Raspberry Pi para Raspberry'
+- default_title: 'Pinout de Raspberry Pi - Pi 1, B+, Pi 2'
+- title_suffix: ' at Raspberry Pi GPIO Pinout'
+- home: 'Home'
+- boards: 'Boards'
+- details: 'Details'
+- group_other: 'otro'
+- form_undefined: 'Otro'
+- pin_header: '{} pin header'
+- type_hat: 'formato HAT'
+- type_phat: 'formato pHAT'
+- type_classic: 'formato clásico'
+- eeprom_detect: 'EEPROM ID'
+- eeprom_setup: 'Usa EEPROM'
+- uses_i2c: 'Usa I2C'
+- uses_spi: 'Usa SPI'
+- uses_5v_and_3v3: 'Alimentación 5v+3v3'
+- uses_5v: 'Alimentación 5v'
+- uses_3v3: 'Alimentación 3v3'
+- uses_n_gpio_pins: 'Usa {} GPIO pins'
+- bcm_pin_rev1_pi: 'BCM pin {} on Rev 1 ( very early ) Pi'
+- physical_pin_n: 'Physical pin {}'
+- wiring_pi_pin: 'Wiring Pi pin {}'
+- made_by: 'Hecho por {manufacturer}'
+- more_information: 'More Information'
+- github_repository: 'GitHub'
+- board_schematic : 'Schematic'
+- buy_now: 'Buy Now'
+- browse_addons: 'Browse more HATs, pHATs and add-ons'
+- return_home: 'Return to the Raspberry Pi GPIO Pinout'
+- boards_title: 'Raspberry Pi HATs, pHATs & Add-ons'
+- boards_subtitle: 'Click on a HAT, pHAT or add-on for more details and to see which pins it uses!'
File renamed without changes.
View
@@ -1,44 +1,10 @@
----
-default_desc: Le guide complet des broches GPIO de la Raspberry Pi
-default_title: Raspberry Pi GPIO Pinout - Pi 1, B+, Pi 2
-title_suffix: " Raspberry Pi GPIO Pinout"
-base_url: /pinout/
-resource_url: /resources/
domain: fr.pinout.xyz
analytics_id: UA-69846516-3
+base_url: /pinout/
+resource_url: /resources/
url_suffix:
urls:
GND: masse
-strings:
-- home: 'Accueil'
-- boards: 'Cartes'
-- details: 'Détails'
-- group_other: 'autre'
-- form_undefined: 'Autre'
-- pin_header: '{} broches'
-- type_hat: 'carte au format HAT'
-- type_phat: 'carte au format pHAT'
-- type_classic: 'carte au format Classic'
-- eeprom_detect: 'identification produit par EEPROM'
-- eeprom_setup: 'configuration automatique par EEPROM'
-- uses_i2c: 'communication par bus I2C'
-- uses_spi: 'communication par bus SPI'
-- uses_5v_and_3v3: 'alimentation 5v et 3v3'
-- uses_5v: 'alimentation 5v'
-- uses_3v3: 'alimentation 3v3'
-- uses_n_gpio_pins: '{} broches GPIO actives'
-- bcm_pin_rev1_pi: 'broche BCM {} sur Raspi Rev 1'
-- physical_pin_n: 'broche physique {}'
-- wiring_pi_pin: 'broche Wiring Pi {}'
-- made_by: 'fabriqué par {manufacturer}'
-- more_information: 'plus d''info'
-- github_repository: 'lien GitHub'
-- board_schematic : 'schéma'
-- buy_now: 'achat'
-- browse_addons: 'Voir toutes les cartes disponibles'
-- return_home: 'Retour à l''accueil'
-- boards_title: "Cartes d'extension pour la Raspberry Pi"
-- boards_subtitle: "Cliquez sur une carte ci-dessous pour en révéler tous les détails!"
featured:
- 4tronix-picon-zero
- ab-adc-pi-zero
Oops, something went wrong.

0 comments on commit 04f1c5d

Please sign in to comment.