-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added time_format translations #7
base: master
Are you sure you want to change the base?
Conversation
@pedromvieira Thanks for your work! Will look into this shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got some remarks, please discuss 😉
def time_format(:"zh-CN"), do: {:ok, "%H:%M"} | ||
def time_format(:"zh-HK"), do: {:ok, "%H:%M"} | ||
def time_format(:"zh-TW"), do: {:ok, "%H:%M"} | ||
def time_format(:"zh-YUE"), do: {:ok, "%H:%M"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did you take these format strings from? They seem pretty inconsistent to me at first glance, for example most do not include seconds while some do. For example sw, ko, fr-CH.
def time_format(:"es-CR"), do: {:ok, "%I:%M %p"} | ||
def time_format(:"es-EC"), do: {:ok, "%-I:%M %p"} | ||
def time_format(:"es-MX"), do: {:ok, "%I:%M %p"} | ||
def time_format(:"es-PA"), do: {:ok, "%-I:%M %p"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is %-I
? Can't seem to find it in the docs.
def time_format(:he), do: {:ok, "%H:%M"} | ||
def time_format(:hi), do: {:ok, "%H:%M"} | ||
def time_format(:"hi-IN"), do: {:ok, "%H:%M"} | ||
def time_format(:hr), do: {:ok, "%e. %B %Y. %H:%M"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this include the date?
@@ -11,7 +11,7 @@ Add `:calendar_translations` to your list of dependencies in `mix.exs`: | |||
|
|||
```elixir | |||
def deps do | |||
[{:calendar_translations, "~> 0.0.4"}] | |||
[{:calendar_translations, "~> 0.0.5"}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply from looking at the test case (same code, output changed) we should at least bump the minor version IMO.
def time_format(:csb), do: {:ok, "%H:%M"} | ||
def time_format(:cy), do: {:ok, "%H:%M"} | ||
def time_format(:da), do: {:ok, "%H.%M"} | ||
def time_format(:de), do: {:ok, "%H:%M Uhr"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am German and here you can write timestamps both with and without the "Uhr" suffix. I am honestly not so sure whether we can make this choice for the user. I'd rather be as consistent as possible across locales by choosing the simplest possible version. In this case it would make sense for me to drop the suffix. Not sure whether this is optional in other languages as well.
def time_format(:"zh-CN"), do: {:ok, "%H:%M"} | ||
def time_format(:"zh-HK"), do: {:ok, "%H:%M"} | ||
def time_format(:"zh-TW"), do: {:ok, "%H:%M"} | ||
def time_format(:"zh-YUE"), do: {:ok, "%H:%M"} | ||
def time_format(_), do: {:ok, "%H:%M:%S"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most versions don't include seconds so IMO the fallback should not include them as well.
Support for translation only time part of a datetime.