Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .tool-versions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file :)

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
elixir 1.20.0-rc.6
erlang 27.3.3
13 changes: 4 additions & 9 deletions lib/gettext.ex
Original file line number Diff line number Diff line change
Expand Up @@ -804,15 +804,10 @@ defmodule Gettext do
@doc since: "1.0.0"
@spec put_locale!(backend, locale) :: locale | nil
def put_locale!(backend, locale) when is_binary(locale) do
cond do
not is_binary(locale) ->
raise ArgumentError, "put_locale/2 only accepts binary locales, got: #{inspect(locale)}"

locale in known_locales(backend) ->
put_locale(backend, locale)

true ->
raise ArgumentError, "put_locale!/2 only support known locales, got: #{inspect(locale)}"
if locale in known_locales(backend) do
put_locale(backend, locale)
else
raise ArgumentError, "put_locale!/2 only support known locales, got: #{inspect(locale)}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/gettext/compiler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ defmodule Gettext.Compiler do
:parallel ->
grouped
|> Enum.map(fn {module, files} ->
Kernel.ParallelCompiler.async(fn ->
Task.async(fn ->
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It must use the Kernel.ParallelCompiler.pmap. Using Task is wrong as it cannot track modules.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will also need to bump the minimum Elixir version on mix.exs and CI.

compile_split_po_files(env, module, files, plural_mod, opts[:interpolation])
end)
end)
Expand Down
5 changes: 0 additions & 5 deletions lib/gettext/extractor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,6 @@ defmodule Gettext.Extractor do
end
end

defp ensure_empty_msgstr!(%Message.Plural{} = message) do
raise Error,
"plural message with msgid '#{IO.iodata_to_binary(message.msgid)}' has a non-empty msgstr"
end

Comment on lines -391 to -395
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was dead code, correct?

defp blank?(str) when not is_nil(str), do: IO.iodata_length(str) == 0
defp blank?(_), do: true

Expand Down