Original Text in Portuguese Brazil
## Melhoria no endereçamento brasileiro.
O endereço no Brasil possui os seguintes elementos (marcado onde a implementação atual contempla)
faltando somente atender o complemento
A linha do complemento é formado por identificador de quadra, bloco, anexo, ..., ou um ponto de referência para localizar o imóvel.
O complemento é incluindo antes do bairro e depois da informação da rua, numero.
- exemplo de complemento:
- apartamento 201
- bloco 10, apartamento 201
- Quadra 7
- Anexo D
- Casa F
- Fundos
- Sobrado
Para continuar mantendo compatibilidade com o padrão da api atual
Uma solução (rápida) pode ser feita a nível do template:
- incluir o
{{{quarter}}}, que representaria o "complemento" do endereço (já que o quarter faz parte do complemento, e das variáveis é a única que se aproxima do conceito de complemento)
Existem 3 possibilidades para Adicionar o Complemento
-
Criar uma nova variável:
- Vantagem: Permite um controle total sobre a posição e o formato do complemento.
- Desvantagem: Requer mais customização e pode tornar a template mais complexa.
-
Utilizar uma variável existente:
- Vantagem: Pode ser mais simples, especialmente se houver uma variável que já contém informações semelhantes.
- Desvantagem: Pode limitar a flexibilidade na formatação.
-
Combinar ambas as opções:
- Vantagem: Permite um equilíbrio entre flexibilidade e simplicidade.
- Desvantagem: Pode exigir um pouco mais de trabalho inicial.
Exemplo Prático
-
Adicionando uma variável {{{address_complement}}} ou {{{complement}}}
Onde, complement contém o complemento do endereço (Apt. 201, Bloco B, etc.).
o template ficaria assim:
address-formatting/conf/countries/worldwide.yaml#L439C1-L451C1
# Brazil
BR:
address_template: |
{{{attention}}}
{{{house}}}
- {{{road}}} {{{house_number}}}
+ {{{road}}} {{{house_number}}} {{{complement}}}
{{#first}} {{{suburb}}} || {{{city_district}}} || {{{village}}} || {{{hamlet}}}{{/first}}
{{#first}} {{{city}}} || {{{town}}} || {{{state_district}}} {{/first}} - {{#first}} {{{state_code}}} || {{{state}}} {{/first}}
{{{postcode}}}
{{{country}}}
postformat_replace:
- ["\\b(\\d{5})(\\d{3})\\b","$1-$2"]
Com a adição de complement, é necessário mapear a nova variável para não cair em {{{attention}}}
address-formatting/conf/components.yaml#L101
...
---
name: continent
+ ---
+ name: complement
-
Utilizar uma variável existente.
Comentado no tópico anterior, poderemos utilizar o {{{quarter}}}.
o template ficaria assim:
address-formatting/conf/countries/worldwide.yaml#L439C1-L451C1
# Brazil
BR:
address_template: |
{{{attention}}}
{{{house}}}
- {{{road}}} {{{house_number}}}
+ {{{road}}} {{{house_number}}} {{{quarter}}}
{{#first}} {{{suburb}}} || {{{city_district}}} || {{{village}}} || {{{hamlet}}}{{/first}}
{{#first}} {{{city}}} || {{{town}}} || {{{state_district}}} {{/first}} - {{#first}} {{{state_code}}} || {{{state}}} {{/first}}
{{{postcode}}}
{{{country}}}
postformat_replace:
- ["\\b(\\d{5})(\\d{3})\\b","$1-$2"]
-
Combinar ambas as opções:
address-formatting/conf/countries/worldwide.yaml#L439C1-L451C1
# Brazil
BR:
address_template: |
{{{attention}}}
{{{house}}}
- {{{road}}} {{{house_number}}}
+ {{{road}}} {{{house_number}}} {{#first}} , {{{quarter}}}, {{{complement}}} || , {{{complement}}}{{/first}}
{{#first}} {{{suburb}}} || {{{city_district}}} || {{{village}}} || {{{hamlet}}}{{/first}}
{{#first}} {{{city}}} || {{{town}}} || {{{state_district}}} {{/first}} - {{#first}} {{{state_code}}} || {{{state}}} {{/first}}
{{{postcode}}}
{{{country}}}
postformat_replace:
- ["\\b(\\d{5})(\\d{3})\\b","$1-$2"]
address-formatting/conf/components.yaml#L101
...
---
name: continent
+ ---
+ name: complement
+ aliases:
+ - quarter
Improving Brazilian Address Formatting
Brazilian addresses typically include the following components (marked where the current implementation supports them):
Missing: Address Complement
The address complement can include a block identifier, annex, or other reference point to locate the property.
The complement should be placed before the neighborhood and after the street name and number.
- Examples of complements:
- apartamento 201
- bloco 10, apartamento 201
- Quadra 7
- Anexo D
- Casa F
- Fundos
- Sobrado
Maintaining Compatibility with the Current API
A quick solution could be implemented at the template level:
- Introduce
{{{quarter}}} to represent the address complement (since "quarter" is part of the complement and is the closest existing variable).
Three Approaches to Add the Complement
-
Create a new variable:
- Advantage: Provides full control over the complement's position and format.
- Disadvantage: Requires more customization and can complicate the template.
-
Utilize an existing variable:
- Advantage: Simpler, especially if a similar variable already exists.
- Disadvantage: May limit formatting flexibility.
-
Combine both options:
- Advantage: Balances flexibility and simplicity.
- Disadvantage: Requires more initial setup.
Practical Example
-
Adding a new variable {{{address_complement}}} or {{{complement}}}:
Where complement contains the address complement (Apt. 201, Block B, etc.).
The template would look like this:
address-formatting/conf/countries/worldwide.yaml#L439C1-L451C1
# Brazil
BR:
address_template: |
{{{attention}}}
{{{house}}}
- {{{road}}} {{{house_number}}}
+ {{{road}}} {{{house_number}}} {{{complement}}}
{{#first}} {{{suburb}}} || {{{city_district}}} || {{{village}}} || {{{hamlet}}}{{/first}}
{{#first}} {{{city}}} || {{{town}}} || {{{state_district}}} {{/first}} - {{#first}} {{{state_code}}} || {{{state}}} {{/first}}
{{{postcode}}}
{{{country}}}
postformat_replace:
- ["\\b(\\d{5})(\\d{3})\\b","$1-$2"]
With the addition of complement, it is necessary to map the new variable so as not to fall to {{{attention}}}
address-formatting/conf/components.yaml#L101
...
---
name: continent
+ ---
+ name: complement
-
Using an existing variable:
As mentioned earlier, we could use {{{quarter}}}.
The template would look like this:
address-formatting/conf/countries/worldwide.yaml#L439C1-L451C1
# Brazil
BR:
address_template: |
{{{attention}}}
{{{house}}}
- {{{road}}} {{{house_number}}}
+ {{{road}}} {{{house_number}}} {{{quarter}}}
{{#first}} {{{suburb}}} || {{{city_district}}} || {{{village}}} || {{{hamlet}}}{{/first}}
{{#first}} {{{city}}} || {{{town}}} || {{{state_district}}} {{/first}} - {{#first}} {{{state_code}}} || {{{state}}} {{/first}}
{{{postcode}}}
{{{country}}}
postformat_replace:
- ["\\b(\\d{5})(\\d{3})\\b","$1-$2"]
-
Combining both options:
address-formatting/conf/countries/worldwide.yaml#L439C1-L451C1
# Brazil
BR:
address_template: |
{{{attention}}}
{{{house}}}
- {{{road}}} {{{house_number}}}
+ {{{road}}} {{{house_number}}} {{#first}} , {{{quarter}}}, {{{complement}}} || , {{{complement}}}{{/first}}
{{#first}} {{{suburb}}} || {{{city_district}}} || {{{village}}} || {{{hamlet}}}{{/first}}
{{#first}} {{{city}}} || {{{town}}} || {{{state_district}}} {{/first}} - {{#first}} {{{state_code}}} || {{{state}}} {{/first}}
{{{postcode}}}
{{{country}}}
postformat_replace:
- ["\\b(\\d{5})(\\d{3})\\b","$1-$2"]
address-formatting/conf/components.yaml#L101
...
---
name: continent
+ ---
+ name: complement
+ aliases:
+ - quarter
Original Text in Portuguese Brazil
## Melhoria no endereçamento brasileiro.O endereço no Brasil possui os seguintes elementos (marcado onde a implementação atual contempla)
faltando somente atender o
complementoO
complementoé incluindo antes do bairro e depois da informação da rua, numero.Para continuar mantendo compatibilidade com o padrão da api atual
Uma solução (rápida) pode ser feita a nível do template:
{{{quarter}}}, que representaria o "complemento" do endereço (já que oquarterfaz parte do complemento, e das variáveis é a única que se aproxima do conceito de complemento)Existem 3 possibilidades para Adicionar o Complemento
Criar uma nova variável:
Utilizar uma variável existente:
Combinar ambas as opções:
Exemplo Prático
Adicionando uma variável
{{{address_complement}}}ou{{{complement}}}Onde,
complementcontém o complemento do endereço (Apt. 201, Bloco B, etc.).o template ficaria assim:
address-formatting/conf/countries/worldwide.yaml#L439C1-L451C1address-formatting/conf/components.yaml#L101Utilizar uma variável existente.
Comentado no tópico anterior, poderemos utilizar o
{{{quarter}}}.o template ficaria assim:
address-formatting/conf/countries/worldwide.yaml#L439C1-L451C1Combinar ambas as opções:
address-formatting/conf/countries/worldwide.yaml#L439C1-L451C1address-formatting/conf/components.yaml#L101Improving Brazilian Address Formatting
Brazilian addresses typically include the following components (marked where the current implementation supports them):
Missing: Address Complement
The
complementshould be placed before the neighborhood and after the street name and number.Maintaining Compatibility with the Current API
A quick solution could be implemented at the template level:
{{{quarter}}}to represent the address complement (since "quarter" is part of the complement and is the closest existing variable).Three Approaches to Add the Complement
Create a new variable:
Utilize an existing variable:
Combine both options:
Practical Example
Adding a new variable
{{{address_complement}}}or{{{complement}}}:Where
complementcontains the address complement (Apt. 201, Block B, etc.).The template would look like this:
address-formatting/conf/countries/worldwide.yaml#L439C1-L451C1address-formatting/conf/components.yaml#L101Using an existing variable:
As mentioned earlier, we could use
{{{quarter}}}.The template would look like this:
address-formatting/conf/countries/worldwide.yaml#L439C1-L451C1Combining both options:
address-formatting/conf/countries/worldwide.yaml#L439C1-L451C1address-formatting/conf/components.yaml#L101