File tree Expand file tree Collapse file tree 3 files changed +33
-4
lines changed Expand file tree Collapse file tree 3 files changed +33
-4
lines changed Original file line number Diff line number Diff line change 3333      docker : ${{ steps.changes.outputs.docker }} 
3434      swagger : ${{ steps.changes.outputs.swagger }} 
3535      yaml : ${{ steps.changes.outputs.yaml }} 
36+       locale : ${{ steps.changes.outputs.locale }} 
3637    steps :
3738      - uses : actions/checkout@v4 
3839      - uses : dorny/paths-filter@v3 
4849              - "Makefile" 
4950              - ".golangci.yml" 
5051              - ".editorconfig" 
51-               - "options/locale/locale_en-US.json" 
5252
5353            frontend: 
5454              - "*.js" 
6363              - ".eslintrc.cjs" 
6464              - ".npmrc" 
6565
66+             locale: 
67+               - "options/locale/*.json" 
68+ 
6669            docs: 
6770              - "**/*.md" 
6871              - ".markdownlint.yaml" 
Original file line number Diff line number Diff line change @@ -110,6 +110,14 @@ jobs:
110110        env :
111111          TAGS : bindata gogit sqlite sqlite_unlock_notify 
112112
113+   checks-locale :
114+     if : needs.files-changed.outputs.locale == 'true' 
115+     needs : files-changed 
116+     runs-on : ubuntu-latest 
117+     steps :
118+       - uses : actions/checkout@v4 
119+       - run : make translation-check 
120+ 
113121  checks-backend :
114122    if : needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' 
115123    needs : files-changed 
Original file line number Diff line number Diff line change @@ -914,14 +914,32 @@ lockfile-check:
914914		exit  1;  \ 
915915	fi 
916916
917+ LOCALE_DIR  := options/locale
918+ LOCALE_FILES  := $(wildcard  $(LOCALE_DIR ) /* .json) 
919+ 
920+ .PHONY : translation-check
921+ translation-check :
922+ 	npm install -g jsonlint find-duplicated-property-keys
923+ 	@echo " Checking JSON files in $( LOCALE_DIR) " 
924+ 	@for f in  $(LOCALE_FILES ) ;  do  \ 
925+ 		echo  " ==> $$ f" ;  \ 
926+ 		if  !  jsonlint -q $$ f >  /dev/null 2>&1 ;  then  \
927+ 			echo  " ❌ Invalid JSON syntax: $$ f" ;  \ 
928+ 			exit  1;  \ 
929+ 		fi ;  \ 
930+ 		if  !  find-duplicated-property-keys -s $$ f >  /dev/null 2>&1 ;  then  \
931+ 			echo  " ❌ Duplicate key found in: $$ f" ;  \ 
932+ 			exit  1;  \ 
933+ 		fi ;  \ 
934+ 	done 
935+ 	@echo " ✅ All JSON files passed" 
936+ 
917937.PHONY : update-translations
918938update-translations :
919939	mkdir -p ./translations
920940	cd  ./translations &&  curl -L https://crowdin.com/download/project/gitea.zip >  gitea.zip &&  unzip gitea.zip
921941	rm ./translations/gitea.zip
922- 	$(SED_INPLACE )  -e ' s/="/=/g' ' s/"$$//g' * .ini
923- 	$(SED_INPLACE )  -e ' s/\\"/"/g' * .ini
924- 	mv ./translations/* .ini ./options/locale/
942+ 	mv ./translations/* .json ./options/locale/
925943	rmdir ./translations
926944
927945.PHONY : generate-gitignore
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments