mirror of
https://gitlab.com/prism-break/prism-break.git
synced 2025-04-24 09:08:29 +00:00
Add scripts to find missing localizations
This commit is contained in:
parent
d8321dea67
commit
58035341dd
6
Makefile
6
Makefile
@ -16,7 +16,7 @@ LANGUAGES := $(notdir $(basename $(wildcard source/locales/*.json)))
|
||||
ASSETS := $(notdir $(wildcard source/assets/*))
|
||||
|
||||
# Mark all rules that don’t actually check whether they need building
|
||||
.PHONY: default test init reset all $(LANGUAGES) assets css html html_% clean watch watch_css sync
|
||||
.PHONY: default test init reset all $(LANGUAGES) assets css html html_% clean watch watch_css sync localize_%
|
||||
|
||||
# Turn on expansion so we can reference target patterns in our dependencies list
|
||||
.SECONDEXPANSION:
|
||||
@ -106,6 +106,10 @@ public/.htaccess: source/dotfiles/.htaccess
|
||||
mkdir -p $(dir $@)
|
||||
cp $< $@
|
||||
|
||||
# Localizations
|
||||
localize_%:
|
||||
lsc ./source/functions/find-missing-localizations.ls $*
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# CONVENIENCE FUNCTIONS
|
||||
#----------------------------------------------------------------------
|
||||
|
9
source/functions/find-missing-localizations.ls
Normal file
9
source/functions/find-missing-localizations.ls
Normal file
@ -0,0 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
load-data = require './load-data.ls'
|
||||
|
||||
iso = process.argv[2]
|
||||
|
||||
load-data "../db/#{iso}-projects.json", iso, true
|
||||
load-data "../db/protocols/#{iso}-protocols.json", iso, true
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
assign = require 'lodash.assign'
|
||||
|
||||
module.exports = load-data = (path, iso) ->
|
||||
module.exports = load-data = (path, iso, find-missing = false) ->
|
||||
en-data = require path.replace('/' + iso, '/en')
|
||||
localized-data = require path
|
||||
|
||||
@ -16,4 +16,8 @@ module.exports = load-data = (path, iso) ->
|
||||
potential-localized-obj = assign {}, obj, localized-obj
|
||||
break
|
||||
|
||||
if find-missing and not potential-localized-obj
|
||||
console.log 'Missing ' + iso + ' localization for ' + obj.name
|
||||
continue
|
||||
|
||||
potential-localized-obj or obj
|
||||
|
Loading…
x
Reference in New Issue
Block a user