在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):elixir-gettext/gettext开源软件地址(OpenSource Url):https://github.com/elixir-gettext/gettext开源编程语言(OpenSource Language):Elixir 100.0%开源软件介绍(OpenSource Introduction):GettextGettext is an internationalization (i18n) and localization (l10n) system commonly used for writing multilingual programs. Gettext is a standard for i18n in different communities, meaning there is a great set of tooling for developers and translators. This project is an implementation of the Gettext system in Elixir. InstallationAdd def deps do
[
{:gettext, ">= 0.0.0"}
]
end Documentation for UsageTo use Gettext, define a Gettext module: defmodule MyApp.Gettext do
use Gettext, otp_app: :my_app
end and invoke the Gettext API, which consists of the import MyApp.Gettext
# Simple message
gettext("Here is one string to translate")
# Plural message
number_of_apples = 4
ngettext("The apple is ripe", "The apples are ripe", number_of_apples)
# Domain-based message
dgettext("errors", "Here is an error message to translate") Messages in Gettext are stored in Portable Object files ( For example, the message to msgid "Here is one string to translate"
msgstr "Aqui está um texto para traduzir"
msgid "Here is the string to translate"
msgid_plural "Here are the strings to translate"
msgstr[0] "Aqui está o texto para traduzir"
msgstr[1] "Aqui estão os textos para traduzir"
Finally, because messages are based on strings, your source code does not lose readability as you still see literal strings, like Read the documentation for the WorkflowGettext is able to automatically extract messages from your source code, alleviating developers and translators from the repetitive and error-prone work of maintaining message files. When extracted from source, messages are placed into In other words, the typical workflow looks like this:
It is also possible to both extract and merge messages in one step with LicenseCopyright 2015 Plataformatec Copyright 2020 Dashbit Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论