diff --git a/_plugins/weblate-source-file.rb b/_plugins/weblate-source-file.rb index 791b4bb0..17c7759e 100644 --- a/_plugins/weblate-source-file.rb +++ b/_plugins/weblate-source-file.rb @@ -19,8 +19,10 @@ module Weblate class ID def self.get(source_text) - source_text.nil? ? source_text - : source_text.strip[0..100].gsub(/[^\w\d\s\.\?\!]/, '').tr(' ', '_') + source_text.nil? or source_text.empty? ? source_text + : source_text.strip[0..100] + .gsub(/([^\w\d\s\.\?\!]|\n)/, '') + .tr(' ', '_') << "_KEY" end end