... たとえばユーザに文字列が表示されるとき) で翻訳される必要があるからです。 複数形 ¶ Use the function django.utils.translation.ngettext() to specify pluralized messages. ngettext は 3 つの引数を取ります: 単数形の文字列、複数形の文字列、オブジェクトの数です。 ... ローカライズさせる必要がある場合に役立ちます。 例: from django.http import HttpResponse from django.utils.translation import ngettext def hello_world ( request , count ): page = ngettext ( "there is %(count)d object" , "there are %(count)d objects" , count ... 。以下のコードは洗練されて見えますが、いくつかの言語に対しては誤った結果を生み出します: from django.utils.translation import ngettext from myapp.models import Report count = Report . objects . count () if count == 1 : name = Report . _meta . verbose_name e ... ... たとえばユーザに文字列が表示されるとき) で翻訳される必要があるからです。 複数形 ¶ Use the function django.utils.translation.ngettext() to specify pluralized messages. ngettext は 3 つの引数を取ります: 単数形の文字列、複数形の文字列、オブジェクトの数です。 ... ローカライズさせる必要がある場合に役立ちます。 例: from django.http import HttpResponse from django.utils.translation import ngettext def hello_world ( request , count ): page = ngettext ( "there is %(count)d object" , "there are %(count)d objects" , count ... 。以下のコードは洗練されて見えますが、いくつかの言語に対しては誤った結果を生み出します: from django.utils.translation import ngettext from myapp.models import Report count = Report . objects . count () if count == 1 : name = Report . _meta . verbose_name e ... ... を知らせるメッセージをフラッシュすることができます: from django.contrib import messages from django.utils.translation import ngettext class ArticleAdmin ( admin . ModelAdmin ): ... def make_published ( self , request , queryset ): updated = queryset . upda ... te ( status = "p" ) self . message_user ( request , ngettext ( " %d story was successfully marked as published." , " %d stories were successfully marked as published." , updated , ) % ... ... quote_plus() , unquote() , and unquote_plus() . django.utils.translation.ugettext() , ugettext_lazy() , ugettext_noop() , ungettext() , and ungettext_lazy() are deprecated in favor of the functions that they're aliases for: django.utils.translation.gette ... xt() , gettext_lazy() , gettext_noop() , ngettext() , and ngettext_lazy() . To limit creation of sessions and hence favor some caching strategies, django.views.i18n.set_lan ... ... を知らせるメッセージをフラッシュすることができます: from django.contrib import messages from django.utils.translation import ngettext class ArticleAdmin ( admin . ModelAdmin ): ... def make_published ( self , request , queryset ): updated = queryset . upda ... te ( status = "p" ) self . message_user ( request , ngettext ( " %d story was successfully marked as published." , " %d stories were successfully marked as published." , updated , ) % ... ... quote_plus() , unquote() , and unquote_plus() . django.utils.translation.ugettext() , ugettext_lazy() , ugettext_noop() , ungettext() , and ungettext_lazy() are deprecated in favor of the functions that they're aliases for: django.utils.translation.gette ... xt() , gettext_lazy() , gettext_noop() , ngettext() , and ngettext_lazy() . To limit creation of sessions and hence favor some caching strategies, django.views.i18n.set_lan ... ... があるため) ベースの言語のままにする必要があるグローバル変数に文字列を保持するために使えます。そして、後の時点で翻訳します。 ngettext ( singular , plural , number ) [ソース] ¶ number に基づいて、 singular と plural を翻訳し、適切な文字列を返します。 npgett ... singular , plural , number ) [ソース] ¶ singular と plural を翻訳し、 number と context に基づいて適切な文字列を返します。 ngettext_lazy ( singular , plural , number ) [ソース] ¶ npgettext_lazy ( context , singular , plural , number ) [ソース] ¶ 上述の l ... ... があるため) ベースの言語のままにする必要があるグローバル変数に文字列を保持するために使えます。そして、後の時点で翻訳します。 ngettext ( singular , plural , number ) [ソース] ¶ number に基づいて、 singular と plural を翻訳し、適切な文字列を返します。 npgett ... singular , plural , number ) [ソース] ¶ singular と plural を翻訳し、 number と context に基づいて適切な文字列を返します。 ngettext_lazy ( singular , plural , number ) [ソース] ¶ npgettext_lazy ( context , singular , plural , number ) [ソース] ¶ 上述の l ... ... cts (models.BaseModelFormSet の属性) next_page (LoginView の属性) (LogoutView の属性) next_page_number() (Page のメソッド) ngettext() (django.utils.translation モジュール) ngettext_lazy() (django.utils.translation モジュール) no_append_slash() (django.vi ... ... cts (models.BaseModelFormSet の属性) next_page (LoginView の属性) (LogoutView の属性) next_page_number() (Page のメソッド) ngettext() (django.utils.translation モジュール) ngettext_lazy() (django.utils.translation モジュール) no_append_slash() (django.vi ... 2026年10月08日