Skip to content

Commit

Permalink
Improve gettext documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
syeopite committed Jul 30, 2021
1 parent a15e3f4 commit c959178
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/backend/gettext/gettext.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
require "./**"

# Namespace for logic relating to the [GNU Gettext](https://www.gnu.org/software/gettext/) format
#
# Gettext is typically separated into two files: `.po` and `.mo`. Both of these formats are fully supported
# by Lens with either the `Gettext::MOBackend` or `Gettext::POBackend` backends.
#
# For more information, please see their respective documentations.
#
# All functionality (except flags) of Gettext are implemented.
module Gettext
extend self

Expand Down
4 changes: 2 additions & 2 deletions src/backend/gettext/mo/backend.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ module Gettext
Dir.glob("#{@locale_directory_path}/**/*.mo") do |gettext_file|
name = File.basename(gettext_file)
if @_source.has_key?(name)
# We're just going to use the end of transmission character to mark files with the same name. This is a major
# back and should be optimized in the future.
# We're just going to use the size of the locale hash to mark files with the same name. This is a major
# hack and should be optimized in the future.
@_source[name + @_source.size.to_s] = File.open(gettext_file)
else
@_source[name] = File.open(gettext_file)
Expand Down
4 changes: 2 additions & 2 deletions src/backend/gettext/po/backend.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ module Gettext
Dir.glob("#{@locale_directory_path}/**/*.po") do |gettext_file|
name = File.basename(gettext_file)
if @_source.has_key?(name)
# We're just going to use the end of transmission character to mark files with the same name. This is a major
# back and should be optimized in the future.
# We're just going to use the size of the locale hash to mark files with the same name. This is a major
# hack and should be optimized in the future.
@_source[name + @_source.size.to_s] = File.read(gettext_file)
else
@_source[name] = File.read(gettext_file)
Expand Down

0 comments on commit c959178

Please sign in to comment.