Add scripts to find missing localizations

This commit is contained in:
Alex Jordan 2016-12-14 00:14:05 -08:00
parent d8321dea67
commit 58035341dd
3 changed files with 19 additions and 2 deletions

View File

@ -16,7 +16,7 @@ LANGUAGES := $(notdir $(basename $(wildcard source/locales/*.json)))
ASSETS := $(notdir $(wildcard source/assets/*))
# Mark all rules that dont 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
#----------------------------------------------------------------------

View 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

View File

@ -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