如何在Heroku中设置语言环境?

时间:2019-06-06 08:59:43

标签: node.js heroku locale

说明

我在Heroku中部署了一个node.js应用程序,并且我想在Heroku中设置比默认语言环境更多的语言环境。为什么?因为我需要将日期保存在es_ES中,而Heroku仅提供en_EN。

我已经尝试过的:

(遵循其官方文档:Heroku locales

  1. heroku buildpacks:添加https://github.com/heroku/heroku-buildpack-locale
  2. 在我的应用程序根目录中创建一个名为“ .locales”的文件,其中填充了“ es_ES”
  3. Heroku上清除的缓存应用程序
  4. 将应用程序部署到Heroku
  5. 在日志中显示检测到并下载了语言包
remote: === Updating or installing language-pack-es-base
remote: Get:1 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease [41.4 kB]
remote: Get:2 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
remote: Get:3 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 Packages [255 kB]
remote: Get:4 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
remote: Get:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
remote: Get:6 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
remote: Get:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]
remote: Get:8 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [324 kB]
remote: Get:9 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages [486 kB]
remote: Get:10 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1213 kB]
remote: Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [826 kB]
remote: Fetched 16.2 MB in 3s (5727 kB/s)
remote: Reading package lists...
remote: Reading package lists...
remote: Building dependency tree...
remote: The following additional packages will be installed:
remote:   language-pack-es
remote: The following NEW packages will be installed:
remote:   language-pack-es language-pack-es-base
remote: 0 upgraded, 2 newly installed, 0 to remove and 31 not upgraded.
remote: Need to get 2847 kB of archives.
remote: After this operation, 12.4 MB of additional disk space will be used.
remote: Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 language-pack-es-base all 1:18.04+20180712 [2845 kB]
remote: Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 language-pack-es all 1:18.04+20180712 [1904 B]
remote: Fetched 2847 kB in 1s (3437 kB/s)
remote: Download complete and in download only mode
remote: === Unpacking and configuring all locales
remote: -----> Discovering process types
remote:        Procfile declares types     -> (none)
remote:        Default types for buildpack -> web
remote:
remote: -----> Compressing...
remote:        Done: 57.9M
remote: -----> Launching...
remote:        Released v161

当前结果

执行'heroku run“ locale -a”'我得到了这个输出

Running locale -a on ⬢ my-super-secret-app... up, run.2545 (Free)
C
C.UTF-8
POSIX
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IL
en_IL.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8

预期

要提供语言包es_ES以便在我要生成日期时使用它。我已经尝试使用javascript Date对象,目前正在使用moment.js,但没有人在工作。

有什么建议吗?

0 个答案:

没有答案
相关问题